Bug 2366 - Effective statements impl for new yang parser.
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / test / augment / AugmentTest.java
index 69b12424587a98596d81a00a3f8dcfc850de8987..85308f284130cf8aac27560ad2d3cd9483d0a1f1 100644 (file)
@@ -43,8 +43,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, VALID_ABS);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -53,8 +57,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, IMPORTED, VALID_ABS_PREFIXED);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -63,8 +71,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, VALID_REL);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -73,8 +85,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, IMPORTED, VALID_REL_PREFIXED);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test