@Test public void testCanGenerateReportTrueWithNoChanges() { final List<String> changedFiles = Collections.emptyList(); JacocoReportChangesMojo mojo = new JacocoReportChangesMojo() { public java.util.List<String> loadIncludes() throws MojoExecutionException { return changedFiles; }; }; assertTrue(mojo.canGenerateReport(true)); }
@Test public void testCanGenerateReportWithChanges() { final List<String> changedFiles = Arrays.asList("a", "b", "c"); JacocoReportChangesMojo mojo = new JacocoReportChangesMojo() { public java.util.List<String> loadIncludes() throws MojoExecutionException { return changedFiles; }; }; assertTrue(mojo.canGenerateReport(true)); }
@Test public void testCanGenerateReportWithLoadError() { JacocoReportChangesMojo mojo = new JacocoReportChangesMojo() { public java.util.List<String> loadIncludes() throws MojoExecutionException { throw new MojoExecutionException("Test"); }; }; mojo.setSkipGenerationWhenNoChangesFound(true); assertFalse(mojo.canGenerateReport(true)); }
@Test public void testCanGenerateReportReturnsFalseWhenSuperReturnsFalse() throws MojoExecutionException { final List<String> changedFiles = Arrays.asList("a", "b", "c"); JacocoReportChangesMojo mojo = new JacocoReportChangesMojo() { public java.util.List<String> loadIncludes() throws MojoExecutionException { return changedFiles; }; }; mojo.setJacocoSkip(true); mojo.injectDefaults(); assertFalse(mojo.canGenerateReport()); }