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.spi.type;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
14 import java.util.Collections;
15 import java.util.Optional;
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 {
22 public void canCreateEmptyType() {
23 EmptyTypeDefinition emptyType = BaseTypes.emptyType();
25 assertEquals("QName", EmptyTypeDefinition.QNAME, emptyType.getQName());
26 assertEquals("BaseType", null, emptyType.getBaseType());
27 assertEquals("DefaultValue", Optional.empty(), emptyType.getDefaultValue());
28 assertEquals("Status", Status.CURRENT, emptyType.getStatus());
29 assertFalse(emptyType.getReference().isPresent());
30 assertEquals("Units", Optional.empty(), emptyType.getUnits());
31 assertFalse(emptyType.getDescription().isPresent());
32 assertEquals("UnknownSchemaNodes", Collections.emptyList(), emptyType.getUnknownSchemaNodes());
33 assertTrue("toString", emptyType.toString().contains("empty"));