public MutationStrategies with(final MutationEngineFactory factory) { return new MutationStrategies(factory, this.history, this.coverage, this.listenerFactory, this.output, this.buildVerifier); }
public static AnalysisResult fail(final Exception error) { return new AnalysisResult(null, error); }
public DirectorySourceLocator(final File root) { this(root, new FileToReader()); }
@Override public CombinedStatistics execute(File baseDir, ReportOptions data, PluginServices plugins, Map<String, String> environmentVariables) throws MojoExecutionException { EntryPoint e = new EntryPoint(); AnalysisResult result = e.execute(baseDir, data, plugins, environmentVariables); if (result.getError().isPresent()) { throw new MojoExecutionException("fail", result.getError().get()); } return result.getStatistics().get(); }
@Test public void shouldReportNoMutationsFoundWhenNoneDetected() { this.data.setFailWhenNoMutations(false); final CombinedStatistics actual = createAndRunTestee(); assertEquals(0, actual.getMutationStatistics().getTotalMutations()); }
public SmartSourceLocator(final Collection<File> roots) { final Collection<File> childDirs = FCollection.flatMap(roots, collectChildren(0)); childDirs.addAll(roots); final Function<File, SourceLocator> fileToSourceLocator = a -> new DirectorySourceLocator(a); this.children = FCollection.map(childDirs, fileToSourceLocator); }
@Test public void shouldConstructWithoutError() { new JarCreatingJarFinder(); // pass }
@Test public void shouldCloseWithoutErrorWhenNoLocationSet() { this.testee.close(); // pass }
@Test public void shouldSetNativeMethodPrefix() throws IOException { assertGeneratedManifestEntryEquals( JarCreatingJarFinder.CAN_SET_NATIVE_METHOD, "true"); }
private Function<File, Collection<File>> collectChildren(final int depth) { return a -> collectDirectories(a, depth); }
private CoverageGenerator coverage() { return this.strategies.coverage(); }
private HistoryStore history() { return this.strategies.history(); }
@Override public Optional<String> getJarLocation() { if (!this.location.isPresent()) { this.location = createJar(); } return this.location; }
private void verifyBuildSuitableForMutationTesting() { this.strategies.buildVerifier().verify(this.code); }
private void assertGeneratedManifestEntryEquals(final String key, final String expected) throws IOException, FileNotFoundException { final String am = getGeneratedManifestAttribute(key); assertEquals(expected, am); }
private static CombinedStatistics runReport(ReportOptions data, PluginServices plugins) { final EntryPoint e = new EntryPoint(); final AnalysisResult result = e.execute(null, data, plugins, new HashMap<String, String>()); if (result.getError().isPresent()) { throw Unchecked.translateCheckedException(result.getError().get()); } return result.getStatistics().get(); }
public MutationStrategies with(final BuildVerifier verifier) { return new MutationStrategies(this.factory, this.history, this.coverage, this.listenerFactory, this.output, verifier); }
public static AnalysisResult success(final CombinedStatistics statistics) { return new AnalysisResult(statistics, null); }
@After public void cleanup() { if (this.testee != null) { this.testee.close(); } }
@Test public void shouldSetCanRedefineClasses() throws IOException { assertGeneratedManifestEntryEquals( JarCreatingJarFinder.CAN_REDEFINE_CLASSES, "true"); }