Remove yang.model.util.BaseTypes
[yangtools.git] / yang / yang-model-util / src / test / java / org / opendaylight / yangtools / yang / model / util / BooleanTypeTest.java
index 431e666cca6b84d7fb6730a5873d2d34ab40ad6b..50d42cdc1e27fcb6b0f4cd20328054c72ed26c7e 100644 (file)
@@ -7,39 +7,31 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Status;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.booleanType;
 
 import java.util.Collections;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import java.util.Optional;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
 
 public class BooleanTypeTest {
-
     @Test
     public void canCreateBooleanType() {
-        BooleanType boolType = BooleanType.getInstance();
-        String stringBoolType = boolType.toString();
+        final BooleanTypeDefinition boolType = booleanType();
 
-        assertEquals("getPath gives List of BOOLEAN_QNAME",
-                Collections.singletonList(BaseTypes.BOOLEAN_QNAME), boolType.getPath().getPathFromRoot());
-
-        assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
-
-        assertEquals("The boolean built-in type represents a boolean value.", boolType.getDescription());
-
-        String strPath = boolType.getPath().toString();
-        assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
-
-        assertEquals("Should be empty string", "", boolType.getUnits());
+        assertEquals("getQName gives BOOLEAN_QNAME", BooleanTypeDefinition.QNAME, boolType.getQName());
+        assertFalse(boolType.getDescription().isPresent());
 
+        assertThat(boolType.toString(), containsString("name=(urn:ietf:params:xml:ns:yang:1)boolean"));
+        assertEquals(Optional.empty(), boolType.getUnits());
         assertEquals("Base type is null", null, boolType.getBaseType());
-
-        assertEquals("Default value is false", false, boolType.getDefaultValue());
-
+        assertEquals(Optional.empty(), boolType.getDefaultValue());
         assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
-
-        assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());
+        assertEquals("Should contain empty list", Collections.emptyList(), boolType.getUnknownSchemaNodes());
     }
-}
\ No newline at end of file
+}