Merge "Bug 1446: Changed QNM to toString listener for debug output"
[yangtools.git] / yang / yang-model-util / src / test / java / org / opendaylight / yangtools / yang / model / util / BooleanTypeTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.util;
9
10 import org.junit.Test;
11 import org.opendaylight.yangtools.yang.model.api.Status;
12
13 import java.util.Collections;
14
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertTrue;
17
18 public class BooleanTypeTest {
19
20     @Test
21     public void canCreateBooleanType() {
22         BooleanType boolType = BooleanType.getInstance();
23         String stringBoolType = boolType.toString();
24
25         assertEquals("getPath gives List of BOOLEAN_QNAME",
26                 Collections.singletonList(BaseTypes.BOOLEAN_QNAME), boolType.getPath().getPathFromRoot());
27
28         assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
29
30         assertEquals("The boolean built-in type represents a boolean value.", boolType.getDescription());
31
32         String strPath = boolType.getPath().toString();
33         assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
34
35         assertEquals("Should be empty string", "", boolType.getUnits());
36
37         assertEquals("Base type is null", null, boolType.getBaseType());
38
39         assertEquals("Default value is false", false, boolType.getDefaultValue());
40
41         assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
42
43         assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());
44     }
45 }