Binding generator v2 - augment statement #1
[mdsal.git] / binding2 / mdsal-binding2-generator-impl / src / test / java / org / opendaylight / mdsal / binding / javav2 / generator / impl / AugmentToGenTypeTest.java
index 63d24bd898d3b8c3952101e67522dbc335aac250..30d5fc64dcaaf491d5e5835ddd5529af3972117f 100644 (file)
@@ -209,14 +209,15 @@ public class AugmentToGenTypeTest {
     @SuppressWarnings("rawtypes")
     @Test
     public void resolveAugmentationsNullModuleTest() throws Exception {
-        final Class[] parameterTypes = { Module.class };
+        final Class[] parameterTypes = { Module.class, SchemaContext.class };
         final Method generate = AugmentToGenType.class.getDeclaredMethod("resolveAugmentations", parameterTypes);
         assertNotNull(generate);
         generate.setAccessible(true);
 
         final Module m = null;
+        final SchemaContext schemaContext = null;
 
-        final Object[] args = { m };
+        final Object[] args = { m, schemaContext };
         try {
             generate.invoke(AugmentToGenType.class, args);
             fail();
@@ -233,15 +234,16 @@ public class AugmentToGenTypeTest {
     @SuppressWarnings("rawtypes")
     @Test
     public void resolveAugmentationsNullAugmentationsTest() throws Exception {
-        final Class[] parameterTypes = { Module.class };
+        final Class[] parameterTypes = { Module.class, SchemaContext.class };
         final Method generate = AugmentToGenType.class.getDeclaredMethod("resolveAugmentations", parameterTypes);
         assertNotNull(generate);
         generate.setAccessible(true);
 
         final Module m = mock(Module.class);
         when(m.getAugmentations()).thenReturn(null);
+        final SchemaContext schemaContext = mock(SchemaContext.class);
 
-        final Object[] args = { m };
+        final Object[] args = { m, schemaContext };
         try {
             generate.invoke(AugmentToGenType.class, args);
             fail();
@@ -258,12 +260,14 @@ public class AugmentToGenTypeTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void resolveAugmentationsTest() throws Exception {
-        final Class[] parameterTypes = { Module.class };
+        final Class[] parameterTypes = { Module.class, SchemaContext.class };
         final Method generate = AugmentToGenType.class.getDeclaredMethod("resolveAugmentations", parameterTypes);
         assertNotNull(generate);
         generate.setAccessible(true);
 
         final Module m = mock(Module.class);
+        final Module m2 = mock(Module.class);
+        final SchemaContext schemaContext = mock(SchemaContext.class);
 
         final Set<AugmentationSchema> augmentations = new HashSet<>();
 
@@ -281,8 +285,10 @@ public class AugmentToGenTypeTest {
         augmentations.add(augmentationSchema2);
 
         when(m.getAugmentations()).thenReturn(augmentations);
+        when(schemaContext.findModuleByNamespaceAndRevision(q2.getNamespace(), q2.getRevision())).thenReturn(m2);
+        when(schemaContext.findModuleByNamespaceAndRevision(q5.getNamespace(), q5.getRevision())).thenReturn(m2);
 
-        final Object[] args = { m };
+        final Object[] args = { m, schemaContext };
 
         final List<AugmentationSchema> result =
                 (List<AugmentationSchema>) generate.invoke(AugmentToGenType.class, args);
@@ -722,6 +728,7 @@ public class AugmentToGenTypeTest {
         assertEquals("pckg.name", moduleContext.getChildNode(path).getPackageName());
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesNullPckgNameTest() throws Exception {
         try {
@@ -733,6 +740,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesNullAugSchemaListEntryTest() throws Exception {
         try {
@@ -744,6 +752,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesEmptyAugSchemaListTest() throws Exception {
         final List<AugmentationSchema> augmentationSchemaList = new ArrayList<>();
@@ -757,6 +766,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesNullAugSchemaNodeTargetPathTest() throws Exception {
         final AugmentationSchema augmentationSchema = mock(AugmentationSchema.class);
@@ -773,6 +783,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesNullAugmentTargetTest() throws Exception {
         final QName qnamePath = QName.create("test", "2017-04-04", "aug");
@@ -818,6 +829,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesNullTargetGTBTest() throws Exception {
         final QName qnamePath = QName.create("test", "2017-04-04", "aug");
@@ -864,6 +876,7 @@ public class AugmentToGenTypeTest {
         }
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesTest() throws Exception {
         final QName qnamePath = QName.create("test", "2017-04-04", "aug");
@@ -912,6 +925,7 @@ public class AugmentToGenTypeTest {
         assertNotNull(result);
     }
 
+    @Deprecated
     @Test
     public void usesAugmentationToGenTypesChoiceTest() throws Exception {
         final QName qnamePath = QName.create("test", "2017-04-04", "aug");