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.assertFalse;
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 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;
21 public class EmptyTypeTest {
23 public void canCreateEmptyType() {
24 EmptyTypeDefinition emptyType = emptyType();
26 assertEquals("QName", EmptyTypeDefinition.QNAME, emptyType.getQName());
27 assertEquals("BaseType", null, emptyType.getBaseType());
28 assertEquals("DefaultValue", Optional.empty(), emptyType.getDefaultValue());
29 assertEquals("Status", Status.CURRENT, emptyType.getStatus());
30 assertFalse(emptyType.getReference().isPresent());
31 assertEquals("Units", Optional.empty(), emptyType.getUnits());
32 assertFalse(emptyType.getDescription().isPresent());
33 assertEquals("UnknownSchemaNodes", Collections.emptyList(), emptyType.getUnknownSchemaNodes());
34 assertTrue("toString", emptyType.toString().contains("empty"));