Integrate JavaTypeName as Identifier
[mdsal.git] / binding / mdsal-binding-generator-util / src / test / java / org / opendaylight / mdsal / binding / model / util / TypesTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.model.util;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12
13 import org.junit.Test;
14 import org.opendaylight.mdsal.binding.model.api.ConcreteType;
15 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
16 import org.opendaylight.mdsal.binding.model.api.Type;
17 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
18 import org.opendaylight.mdsal.binding.model.api.WildcardType;
19
20 public class TypesTest {
21
22     @Test
23     public void testVoidType() {
24         final ConcreteType voidType = Types.voidType();
25         assertEquals("Void", voidType.getName());
26         assertNotNull(voidType);
27     }
28
29     @Test
30     public void testPrimitiveType() {
31         final Type primitiveType = Types.typeForClass(String[].class);
32         assertEquals("String[]", primitiveType.getName());
33     }
34
35     @Test
36     public void testMapTypeFor() {
37         final ParameterizedType mapType = Types.mapTypeFor(null, null);
38         assertEquals("Map", mapType.getName());
39     }
40
41     @Test
42     public void testSetTypeFor() {
43         final ParameterizedType setType = Types.setTypeFor(null);
44         assertEquals("Set", setType.getName());
45     }
46
47     @Test
48     public void testListTypeFor() {
49         final ParameterizedType listType = Types.listTypeFor(null);
50         assertEquals("List", listType.getName());
51     }
52
53     @Test
54     public void testWildcardTypeFor() {
55         final WildcardType wildcardType = Types.wildcardTypeFor(JavaTypeName.create("org.opendaylight.yangtools.test",
56             "WildcardTypeTest"));
57         assertEquals("WildcardTypeTest", wildcardType.getName());
58     }
59
60     @Test
61     public void testAugmentableTypeFor() {
62         ParameterizedType augmentableType = Types.augmentableTypeFor(null);
63         assertEquals("Augmentable", augmentableType.getName());
64     }
65
66     @Test
67     public void augmentationTypeFor() {
68         ParameterizedType augmentationType = Types.augmentationTypeFor(null);
69         assertEquals("Augmentation", augmentationType.getName());
70     }
71 }