Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-model-util / src / test / java / org / opendaylight / yangtools / yang / model / util / EmptyTypeTest.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 static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13 import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.emptyType;
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.EmptyTypeDefinition;
20
21 public class EmptyTypeTest {
22
23     @Test
24     public void canCreateEmptyType() {
25         EmptyTypeDefinition emptyType = emptyType();
26
27         assertEquals("QName", BaseTypes.EMPTY_QNAME, emptyType.getQName());
28         assertEquals("Path", Collections.singletonList(BaseTypes.EMPTY_QNAME),
29                 emptyType.getPath().getPathFromRoot());
30         assertEquals("BaseType", null, emptyType.getBaseType());
31         assertEquals("DefaultValue", Optional.empty(), emptyType.getDefaultValue());
32         assertEquals("Status", Status.CURRENT, emptyType.getStatus());
33         assertFalse(emptyType.getReference().isPresent());
34         assertEquals("Units", Optional.empty(), emptyType.getUnits());
35         assertFalse(emptyType.getDescription().isPresent());
36         assertEquals("UnknownSchemaNodes", Collections.emptyList(), emptyType.getUnknownSchemaNodes());
37         assertTrue("toString", emptyType.toString().contains("empty"));
38     }
39 }