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;
}
}
- @SuppressWarnings("checkstyle:illegalCatch")
static final void assertMojoExecution(final YangToSourcesProcessor processor, final Prepare prepare,
final Verify verify) {
try (MockedStatic<?> staticLoader = mockStatic(ServiceLoader.class)) {
prepare.prepare(generator);
processor.execute();
verify.verify(generator);
- } catch (Exception e) {
+ } catch (FileGeneratorException | MojoExecutionException | MojoFailureException e) {
throw new AssertionError(e);
}
}
@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;
}
}