Update StmtTestUtils
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / semver / SemanticVersionComplexTest.java
index 6a04bf1fdf721e060f5a9cf87ad4bec7915c1088..48b6efb80a85ec6b6f864e1eeb2971029d7f1527 100644 (file)
@@ -11,10 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import java.io.FileNotFoundException;
 import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.ParseException;
 import org.junit.Test;
 import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -22,34 +19,30 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
 
 public class SemanticVersionComplexTest {
 
     @Test
-    public void complexTest1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
-            ParseException {
+    public void complexTest1() throws Exception {
         final SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-1",
                 StatementParserMode.SEMVER_MODE);
         verifySchemaContextTest1(context);
     }
 
     @Test
-    public void complexTest1Yang1_1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
-            ParseException {
+    public void complexTest1Yang1_1() throws Exception {
         final SchemaContext context = StmtTestUtils.parseYangSources("/rfc7950/semantic-version/complex-1",
                 StatementParserMode.SEMVER_MODE);
         verifySchemaContextTest1(context);
     }
 
-    private void verifySchemaContextTest1(final SchemaContext context) throws URISyntaxException {
+    private static void verifySchemaContextTest1(final SchemaContext context) {
         assertNotNull(context);
 
-        final Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
-        final Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
-                .iterator().next();
+        final Module foo = context.findModuleByNamespace(URI.create("foo")).iterator().next();
+        final Module semVer = context.findModuleByNamespace(
+            URI.create("urn:opendaylight:yang:extension:semantic-version")).iterator().next();
 
         // check module versions
         assertEquals(SemVer.valueOf("1.3.95"), semVer.getSemanticVersion());
@@ -77,27 +70,25 @@ public class SemanticVersionComplexTest {
     }
 
     @Test
-    public void complexTest2() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
-            ParseException {
+    public void complexTest2() throws Exception {
         final SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-2",
                 StatementParserMode.SEMVER_MODE);
         verifySchemaContextTest2(context);
     }
 
     @Test
-    public void complexTest2Yang1_1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
-            ParseException {
+    public void complexTest2Yang1_1() throws Exception {
         final SchemaContext context = StmtTestUtils.parseYangSources("/rfc7950/semantic-version/complex-2",
                 StatementParserMode.SEMVER_MODE);
         verifySchemaContextTest2(context);
     }
 
-    private void verifySchemaContextTest2(final SchemaContext context) throws URISyntaxException {
+    private static void verifySchemaContextTest2(final SchemaContext context) {
         assertNotNull(context);
 
-        final Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
-        final Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
-                .iterator().next();
+        final Module foo = context.findModuleByNamespace(URI.create("foo")).iterator().next();
+        final Module semVer = context.findModuleByNamespace(URI.create(
+            "urn:opendaylight:yang:extension:semantic-version")).iterator().next();
 
         // check module versions
         assertEquals(SemVer.valueOf("2.5.50"), semVer.getSemanticVersion());