Update StmtTestUtils
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug6150Test.java
index 18c91a4260ad04cd74aed351517b5f334836c22a..fa286903d4d0ccac2d72587a42461d5a9259c997 100644 (file)
@@ -5,37 +5,28 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
+import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
 public class Bug6150Test {
 
-    private static final YangStatementSourceImpl TARGET = new YangStatementSourceImpl(
-            "/bugs/bug6150/target.yang", false);
-    private static final YangStatementSourceImpl AUGMENT_FIRST = new YangStatementSourceImpl(
-            "/bugs/bug6150/aug-first.yang", false);
-    private static final YangStatementSourceImpl AUGMENT_SECOND = new YangStatementSourceImpl(
-            "/bugs/bug6150/aug-second.yang", false);
-
-    private static void addSources(final BuildAction reactor, final YangStatementSourceImpl... sources) {
-        for (YangStatementSourceImpl source : sources) {
-            reactor.addSource(source);
-        }
-    }
+    private static final StatementStreamSource TARGET = sourceForResource("/bugs/bug6150/target.yang");
+    private static final StatementStreamSource AUGMENT_FIRST = sourceForResource("/bugs/bug6150/aug-first.yang");
+    private static final StatementStreamSource AUGMENT_SECOND = sourceForResource("/bugs/bug6150/aug-second.yang");
 
     @Test
     public void effectiveAugmentFirstTest() throws ReactorException {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        addSources(reactor, TARGET, AUGMENT_FIRST);
+        reactor.addSources(TARGET, AUGMENT_FIRST);
         final SchemaContext result = reactor.buildEffective();
         assertNotNull(result);
     }
@@ -43,7 +34,7 @@ public class Bug6150Test {
     @Test
     public void effectiveAugmentSecondTest() throws ReactorException {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        addSources(reactor, TARGET, AUGMENT_SECOND);
+        reactor.addSources(TARGET, AUGMENT_SECOND);
         final SchemaContext result = reactor.buildEffective();
         assertNotNull(result);
     }
@@ -51,7 +42,7 @@ public class Bug6150Test {
     @Test
     public void effectiveAugmentBothTest() throws ReactorException {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        addSources(reactor, TARGET, AUGMENT_FIRST, AUGMENT_SECOND);
+        reactor.addSources(TARGET, AUGMENT_FIRST, AUGMENT_SECOND);
         final SchemaContext result = reactor.buildEffective();
         assertNotNull(result);
     }