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.booleanType;
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.BooleanTypeDefinition;
20 public class BooleanTypeTest {
23 public void canCreateBooleanType() {
24 final BooleanTypeDefinition boolType = booleanType();
25 final String stringBoolType = boolType.toString();
27 assertEquals("getPath gives List of BOOLEAN_QNAME",
28 Collections.singletonList(BaseTypes.BOOLEAN_QNAME), boolType.getPath().getPathFromRoot());
29 assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
30 assertNull(boolType.getDescription());
32 final String strPath = boolType.getPath().toString();
33 assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
34 assertNull("Should be null", boolType.getUnits());
35 assertEquals("Base type is null", null, boolType.getBaseType());
36 assertNull("Default value is null", boolType.getDefaultValue());
37 assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
38 assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());