*/
package org.opendaylight.yangtools.yang.model.util;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Status;
-
-import java.util.Collections;
-
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.emptyType;
-public class EmptyTypeTest {
+import java.util.Collections;
+import java.util.Optional;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
+public class EmptyTypeTest {
@Test
public void canCreateEmptyType() {
- EmptyType emptyType = EmptyType.getInstance();
+ EmptyTypeDefinition emptyType = emptyType();
- assertEquals("QName", BaseTypes.EMPTY_QNAME, emptyType.getQName());
- assertEquals("Path", Collections.singletonList(BaseTypes.EMPTY_QNAME),
- emptyType.getPath().getPathFromRoot());
+ assertEquals("QName", EmptyTypeDefinition.QNAME, emptyType.getQName());
assertEquals("BaseType", null, emptyType.getBaseType());
- assertEquals("DefaultValue", null, emptyType.getDefaultValue());
+ assertEquals("DefaultValue", Optional.empty(), emptyType.getDefaultValue());
assertEquals("Status", Status.CURRENT, emptyType.getStatus());
- assertTrue("Reference", emptyType.getReference().contains("rfc6020"));
- assertEquals("Units", null, emptyType.getUnits());
- assertNotEquals("Description is not null", null, emptyType.getDescription());
- assertEquals("UnknownSchemaNodes", Collections.EMPTY_LIST, emptyType.getUnknownSchemaNodes());
+ assertFalse(emptyType.getReference().isPresent());
+ assertEquals("Units", Optional.empty(), emptyType.getUnits());
+ assertFalse(emptyType.getDescription().isPresent());
+ assertEquals("UnknownSchemaNodes", Collections.emptyList(), emptyType.getUnknownSchemaNodes());
assertTrue("toString", emptyType.toString().contains("empty"));
}
-}
\ No newline at end of file
+}