Populate data/ hierarchy
[yangtools.git] / model / yang-model-ri / src / test / java / org / opendaylight / yangtools / yang / model / ri / type / 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.ri.type;
9
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertFalse;
14
15 import java.util.Collections;
16 import java.util.Optional;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.api.Status;
19 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
20 import org.opendaylight.yangtools.yang.model.api.type.TypeDefinitions;
21
22 public class BooleanTypeTest {
23     @Test
24     public void canCreateBooleanType() {
25         final BooleanTypeDefinition boolType = BaseTypes.booleanType();
26
27         assertEquals("getQName gives BOOLEAN_QNAME", TypeDefinitions.BOOLEAN, boolType.getQName());
28         assertFalse(boolType.getDescription().isPresent());
29
30         assertThat(boolType.toString(), containsString("name=(urn:ietf:params:xml:ns:yang:1)boolean"));
31         assertEquals(Optional.empty(), boolType.getUnits());
32         assertEquals("Base type is null", null, boolType.getBaseType());
33         assertEquals(Optional.empty(), boolType.getDefaultValue());
34         assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
35         assertEquals("Should contain empty list", Collections.emptyList(), boolType.getUnknownSchemaNodes());
36     }
37 }