2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.util;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNull;
12 import static org.junit.Assert.assertTrue;
13 import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.emptyType;
15 import java.util.Collections;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.Status;
18 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
20 public class EmptyTypeTest {
23 public void canCreateEmptyType() {
24 EmptyTypeDefinition emptyType = emptyType();
26 assertEquals("QName", BaseTypes.EMPTY_QNAME, emptyType.getQName());
27 assertEquals("Path", Collections.singletonList(BaseTypes.EMPTY_QNAME),
28 emptyType.getPath().getPathFromRoot());
29 assertEquals("BaseType", null, emptyType.getBaseType());
30 assertEquals("DefaultValue", null, emptyType.getDefaultValue());
31 assertEquals("Status", Status.CURRENT, emptyType.getStatus());
32 assertNull("Reference", emptyType.getReference());
33 assertEquals("Units", null, emptyType.getUnits());
34 assertNull("Description is not null", emptyType.getDescription());
35 assertEquals("UnknownSchemaNodes", Collections.EMPTY_LIST, emptyType.getUnknownSchemaNodes());
36 assertTrue("toString", emptyType.toString().contains("empty"));