Fix checkstyle in yang-parser-impl and enable enforcement
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / ListKeysTest.java
index e2ab5ca4df304ab49ab0b7335c00525a52d8775b..cff47bd2de416f32f697418aa4c2bcd85aa133de 100644 (file)
@@ -12,11 +12,8 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
 
-import java.io.IOException;
-import java.net.URISyntaxException;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
 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;
@@ -37,7 +34,7 @@ public class ListKeysTest {
     }
 
     @Test
-    public void incorrectListKeysTest1() throws IOException, YangSyntaxErrorException, URISyntaxException {
+    public void incorrectListKeysTest1() {
 
         final StatementStreamSource yangFile = sourceForResource("/list-keys-test/incorrect-list-keys-test.yang");
 
@@ -47,14 +44,13 @@ public class ListKeysTest {
         try {
             reactor.buildEffective();
             fail("effective build should fail due to list instead of leaf referenced in list key");
-        } catch (Exception e) {
-            assertTrue(e instanceof ReactorException);
+        } catch (ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith("Key 'test1_key1 test1_key2' misses node 'test1_key2'"));
         }
     }
 
     @Test
-    public void incorrectListKeysTest2() throws IOException, YangSyntaxErrorException, URISyntaxException {
+    public void incorrectListKeysTest2() {
 
         final StatementStreamSource yangFile = sourceForResource("/list-keys-test/incorrect-list-keys-test2.yang");
 
@@ -64,14 +60,13 @@ public class ListKeysTest {
         try {
             reactor.buildEffective();
             fail("effective build should fail due to missing leaf referenced in list key");
-        } catch (Exception e) {
-            assertTrue(e instanceof ReactorException);
+        } catch (ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith("Key 'test1_key1 test1_key2' misses node 'test1_key2'"));
         }
     }
 
     @Test
-    public void incorrectListKeysTest3() throws IOException, YangSyntaxErrorException, URISyntaxException {
+    public void incorrectListKeysTest3() {
 
         final StatementStreamSource yangFile = sourceForResource("/list-keys-test/incorrect-list-keys-test3.yang");
 
@@ -81,14 +76,13 @@ public class ListKeysTest {
         try {
             reactor.buildEffective();
             fail("effective build should fail due to list instead of leaf in grouping referenced in list key");
-        } catch (Exception e) {
-            assertTrue(e instanceof ReactorException);
+        } catch (ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith("Key 'grp_list' misses node 'grp_list'"));
         }
     }
 
     @Test
-    public void incorrectListKeysTest4() throws IOException, YangSyntaxErrorException, URISyntaxException {
+    public void incorrectListKeysTest4()  {
 
         final StatementStreamSource yangFile = sourceForResource("/list-keys-test/incorrect-list-keys-test4.yang");
 
@@ -97,10 +91,9 @@ public class ListKeysTest {
 
         try {
             reactor.buildEffective();
-            fail("effective build should fail due to list instead of leaf in grouping augmented to list referenced " +
-                    "in list key");
-        } catch (Exception e) {
-            assertTrue(e instanceof ReactorException);
+            fail("effective build should fail due to list instead of leaf in grouping augmented to list referenced "
+                    + "in list key");
+        } catch (ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith("Key 'grp_leaf' misses node 'grp_leaf'"));
         }
     }