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;
14 import java.util.Collections;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.api.Status;
17 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
19 public class EmptyTypeTest {
22 public void canCreateEmptyType() {
23 EmptyTypeDefinition emptyType = emptyType();
25 assertEquals("QName", BaseTypes.EMPTY_QNAME, emptyType.getQName());
26 assertEquals("Path", Collections.singletonList(BaseTypes.EMPTY_QNAME),
27 emptyType.getPath().getPathFromRoot());
28 assertEquals("BaseType", null, emptyType.getBaseType());
29 assertEquals("DefaultValue", null, emptyType.getDefaultValue());
30 assertEquals("Status", Status.CURRENT, emptyType.getStatus());
31 assertNull("Reference", emptyType.getReference());
32 assertEquals("Units", null, emptyType.getUnits());
33 assertNull("Description is not null", emptyType.getDescription());
34 assertEquals("UnknownSchemaNodes", Collections.EMPTY_LIST, emptyType.getUnknownSchemaNodes());
35 assertTrue("toString", emptyType.toString().contains("empty"));