Map identities to proper objects
[mdsal.git] / binding / mdsal-binding-java-api-generator / src / test / java / org / opendaylight / mdsal / binding / java / api / generator / CompilationTest.java
index 1a965008ad8ab05c9a36181d7f219ec4fdceb72b..f3d640aa8dda14d476f6f399c6db447eee1113a3 100644 (file)
@@ -24,6 +24,7 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.lang.reflect.WildcardType;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -377,8 +378,7 @@ public class CompilationTest extends BaseCompilationTest {
         assertTrue(new File(parent, "Nodes.java").exists());
         assertTrue(new File(parent, "NodesBuilder.java").exists());
         assertTrue(new File(parent, "Alg.java").exists());
-        assertTrue(new File(parent, "NodesIdUnionBuilder.java").exists());
-        CompilationTestUtils.assertFilesCount(parent, 6);
+        CompilationTestUtils.assertFilesCount(parent, 5);
 
         // Test if sources are compilable
         CompilationTestUtils.testCompilation(sourcesOutputDir, compiledOutputDir);
@@ -751,17 +751,9 @@ public class CompilationTest extends BaseCompilationTest {
 
     private static void testReturnTypeIdentityref(final Class<?> clazz, final String methodName,
             final String returnTypeStr) throws NoSuchMethodException {
-        Method method = clazz.getMethod(methodName);
-        assertEquals(java.lang.Class.class, method.getReturnType());
-        java.lang.reflect.Type returnType = method.getGenericReturnType();
-        assertTrue(returnType instanceof ParameterizedType);
-        final ParameterizedType pt = (ParameterizedType) returnType;
-        final java.lang.reflect.Type[] parameters = pt.getActualTypeArguments();
-        assertEquals(1, parameters.length);
-        final java.lang.reflect.Type parameter = parameters[0];
-        assertTrue(parameter instanceof WildcardType);
-        final WildcardType wildcardType = (WildcardType) parameter;
-        assertEquals("? extends " + returnTypeStr, wildcardType.toString());
+        Class<?> returnType = clazz.getMethod(methodName).getReturnType();
+        assertTrue(returnType.isInterface());
+        assertEquals(returnTypeStr, returnType.getName());
     }
 
     private static void testReturnTypeInstanceIdentitifer(final ClassLoader loader, final Class<?> clazz,
@@ -770,12 +762,12 @@ public class CompilationTest extends BaseCompilationTest {
         final Class<?> rawReturnType = Class.forName("org.opendaylight.yangtools.yang.binding.InstanceIdentifier", true,
             loader);
         assertEquals(rawReturnType, method.getReturnType());
-        final java.lang.reflect.Type returnType = method.getGenericReturnType();
+        final Type returnType = method.getGenericReturnType();
         assertTrue(returnType instanceof ParameterizedType);
         final ParameterizedType pt = (ParameterizedType) returnType;
-        final java.lang.reflect.Type[] parameters = pt.getActualTypeArguments();
+        final Type[] parameters = pt.getActualTypeArguments();
         assertEquals(1, parameters.length);
-        final java.lang.reflect.Type parameter = parameters[0];
+        final Type parameter = parameters[0];
         assertTrue(parameter instanceof WildcardType);
         final WildcardType wildcardType = (WildcardType) parameter;
         assertEquals("?", wildcardType.toString());