Speed up BaseYangTypesProvider
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / BaseTypeProvider.java
1 /*
2  * Copyright (c) 2013 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.generator.impl;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
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.util.BaseYangTypes;
18 import org.opendaylight.mdsal.binding.model.util.Types;
19
20 public class BaseTypeProvider {
21
22     @Test
23     public void test() {
24         Type stringType = BaseYangTypes.javaTypeForYangType("string");
25         assertEquals("java.lang", stringType.getPackageName());
26         assertEquals("String", stringType.getName());
27         assertTrue(stringType instanceof ConcreteType);
28         ParameterizedType stringBooleanMap = Types.mapTypeFor(
29             BaseYangTypes.javaTypeForYangType("string"),
30             BaseYangTypes.javaTypeForYangType("boolean"));
31         assertTrue(!(stringBooleanMap instanceof ConcreteType));
32         assertEquals("java.util", stringBooleanMap.getPackageName());
33         assertEquals("Map", stringBooleanMap.getName());
34         assertEquals(2, stringBooleanMap.getActualTypeArguments().length);
35     }
36 }