2 * Copyright (c) 2014 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.mdsal.binding.model.ri;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.binding.model.api.ConcreteType;
15 import org.opendaylight.yangtools.binding.model.api.JavaTypeName;
16 import org.opendaylight.yangtools.binding.model.api.ParameterizedType;
17 import org.opendaylight.yangtools.binding.model.api.Type;
18 import org.opendaylight.yangtools.binding.model.api.WildcardType;
20 public class TypesTest {
23 public void testVoidType() {
24 final ConcreteType voidType = Types.voidType();
25 assertEquals("Void", voidType.getName());
26 assertNotNull(voidType);
30 public void testPrimitiveType() {
31 final Type primitiveType = Types.typeForClass(String[].class);
32 assertEquals("String[]", primitiveType.getName());
36 public void testMapTypeFor() {
37 final ParameterizedType mapType = Types.mapTypeFor(Types.objectType(), Types.objectType());
38 assertEquals("Map", mapType.getName());
41 @Test(expected = NullPointerException.class)
42 public void testMapTypeForNull() {
43 Types.mapTypeFor(null, null);
47 public void testSetTypeFor() {
48 final ParameterizedType setType = Types.setTypeFor(Types.objectType());
49 assertEquals("Set", setType.getName());
52 @Test(expected = NullPointerException.class)
53 public void testSetTypeForNull() {
54 Types.setTypeFor(null);
58 public void testListTypeFor() {
59 final ParameterizedType listType = Types.listTypeFor(Types.objectType());
60 assertEquals("List", listType.getName());
63 @Test(expected = NullPointerException.class)
64 public void testListTypeForNull() {
65 Types.listTypeFor(null);
69 public void testWildcardTypeFor() {
70 final WildcardType wildcardType = Types.wildcardTypeFor(JavaTypeName.create("org.opendaylight.yangtools.test",
72 assertEquals("WildcardTypeTest", wildcardType.getName());