2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.util;
10 import org.junit.Test;
11 import org.opendaylight.yangtools.yang.model.api.Status;
13 import java.util.Collections;
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertTrue;
18 public class BooleanTypeTest {
21 public void canCreateBooleanType() {
22 BooleanType boolType = BooleanType.getInstance();
23 String stringBoolType = boolType.toString();
25 assertEquals("getPath gives List of BOOLEAN_QNAME",
26 Collections.singletonList(BaseTypes.BOOLEAN_QNAME), boolType.getPath().getPathFromRoot());
28 assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
30 assertEquals("The boolean built-in type represents a boolean value.", boolType.getDescription());
32 String strPath = boolType.getPath().toString();
33 assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
35 assertEquals("Should be empty string", "", boolType.getUnits());
37 assertEquals("Base type is null", null, boolType.getBaseType());
39 assertEquals("Default value is false", false, boolType.getDefaultValue());
41 assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
43 assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());