Remove a warning suppression 22/104622/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Feb 2023 13:29:00 +0000 (14:29 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Feb 2023 13:29:00 +0000 (14:29 +0100)
We can use FileGeneratorException as the precise exception, keeping
checkstyle happy.

Change-Id: Iaa8218d1e4c669384c3682c7bd0e7000ef7389f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
plugin/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/AbstractCodeGeneratorTest.java

index cde0ee6555418987baa15944d594661fe2218d13..89af5b178f6ca9b37cb081a61121cabec4b783ee 100644 (file)
@@ -22,6 +22,8 @@ import java.util.List;
 import java.util.ServiceLoader;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -56,7 +58,6 @@ public abstract class AbstractCodeGeneratorTest {
         }
     }
 
-    @SuppressWarnings("checkstyle:illegalCatch")
     static final void assertMojoExecution(final YangToSourcesProcessor processor, final Prepare prepare,
             final Verify verify) {
         try (MockedStatic<?> staticLoader = mockStatic(ServiceLoader.class)) {
@@ -80,7 +81,7 @@ public abstract class AbstractCodeGeneratorTest {
                 prepare.prepare(generator);
                 processor.execute();
                 verify.verify(generator);
-            } catch (Exception e) {
+            } catch (FileGeneratorException | MojoExecutionException | MojoFailureException e) {
                 throw new AssertionError(e);
             }
         }
@@ -88,11 +89,11 @@ public abstract class AbstractCodeGeneratorTest {
 
     @FunctionalInterface
     interface Prepare {
-        void prepare(FileGenerator mock) throws Exception;
+        void prepare(FileGenerator mock) throws FileGeneratorException;
     }
 
     @FunctionalInterface
     interface Verify {
-        void verify(FileGenerator mock) throws Exception;
+        void verify(FileGenerator mock) throws FileGeneratorException;
     }
 }