BUG-4688: Rework SchemaContext module lookups
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / stmt / rfc7950 / IdentityStatementTest.java
index fe90d1bbaa0e4db292da6beb5c7d83c819ab42ae..bce4e8df1f8a9468315232c2fdcd4acd5fcb6fdb 100644 (file)
@@ -13,13 +13,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
-import java.text.ParseException;
-import java.util.Date;
 import java.util.Set;
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -29,16 +25,11 @@ import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
 public class IdentityStatementTest {
 
     @Test
-    public void testMultipleBaseIdentities() throws ReactorException, FileNotFoundException, URISyntaxException,
-            ParseException {
+    public void testMultipleBaseIdentities() throws Exception {
         final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/identity-stmt/foo.yang");
         assertNotNull(schemaContext);
 
-        final Date revision = SimpleDateFormatUtil.getRevisionFormat().parse("2016-12-21");
-
-        final Module foo = schemaContext.findModuleByName("foo", revision);
-        assertNotNull(foo);
-
+        final Module foo = schemaContext.findModule("foo", QName.parseRevision("2016-12-21")).get();
         final Set<IdentitySchemaNode> identities = foo.getIdentities();
         for (final IdentitySchemaNode identity : identities) {
             if ("derived-id".equals(identity.getQName().getLocalName())) {
@@ -49,7 +40,7 @@ public class IdentityStatementTest {
     }
 
     @Test
-    public void testInvalidYang10() throws FileNotFoundException, URISyntaxException {
+    public void testInvalidYang10() throws Exception {
         try {
             StmtTestUtils.parseYangSource("/rfc7950/identity-stmt/foo10.yang");
             fail("Test should fail due to invalid Yang 1.0");