public ProjectClassPaths getMutationClassPaths() { return new ProjectClassPaths(this.getClassPath(), createClassesFilter(), createPathFilter()); }
public Collection<ClassInfo> getCode() { return this.classPath.code().stream() .flatMap(nameToClassInfo()) .collect(Collectors.toList()); }
public List<ClassInfo> getTests() { return this.classPath.test().stream() .flatMap(nameToClassInfo()) .filter(ClassInfo.matchIfAbstract().negate()) .collect(Collectors.toList()); }
public ClassPath getClassPath() { return this.classPath.getClassPath(); }
public CodeSource(final ProjectClassPaths classPath) { this(classPath, new Repository(new ClassPathByteArraySource( classPath.getClassPath()))); }
private ProjectClassPaths createProjectClassPaths() { final ClassPath classPath = new ClassPath(this.compiledCodeDirectories); final Predicate<String> classPredicate = createClassPredicate(); final Predicate<ClassPathRoot> pathPredicate = new DefaultCodePathPredicate(); return new ProjectClassPaths(classPath, new ClassFilter(classPredicate, classPredicate), new PathFilter(pathPredicate, Prelude.not(new DefaultDependencyPathPredicate()))); }
@Test public void shouldIdentifyAllNonTestCodeOnClassPathWhenNoTestsPresent() { when(this.classPath.code()).thenReturn( Arrays.asList(this.foo.getName(), this.bar.getName())); assertEquals(Arrays.asList(this.foo, this.bar), this.testee.getCode()); }
@Test public void shouldIdentifyTestClassesOnTestPath() { when(this.classPath.test()).thenReturn( Arrays.asList(this.foo.getName(), this.bar.getName())); assertThat(this.testee.getTests()).containsExactly(this.foo, this.bar); }
public ClassPath getClassPath() { return this.classPath.getClassPath(); }
protected void createAndRun(SettingsFactory settings) { final JavaAgent agent = new JarCreatingJarFinder(); try { final CoverageOptions coverageOptions = createCoverageOptions(settings.createCoverageOptions().getPitConfig()); final LaunchOptions launchOptions = new LaunchOptions(agent, new DefaultJavaExecutableLocator(), this.data.getJvmArgs(), new HashMap<String, String>()); final PathFilter pf = new PathFilter(p -> true, p -> true); final ProjectClassPaths cps = new ProjectClassPaths( this.data.getClassPath(), this.data.createClassesFilter(), pf); final Timings timings = new Timings(); final CodeSource code = new CodeSource(cps); final CoverageGenerator coverageDatabase = new DefaultCoverageGenerator( null, coverageOptions, launchOptions, code, new NullCoverageExporter(), timings, false); final HistoryStore history = new NullHistoryStore(); final MutationStrategies strategies = new MutationStrategies( new GregorEngineFactory(), history, coverageDatabase, listenerFactory(), null); final MutationCoverage testee = new MutationCoverage(strategies, null, code, this.data, new SettingsFactory(this.data, this.plugins), timings); testee.runReport(); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } finally { agent.close(); } }
@Test public void shouldProvideNamesOfCodeClasses() { final ClassInfo foo = makeClassInfo("Foo"); final ClassInfo bar = makeClassInfo("Bar"); when(this.classPath.code()).thenReturn( Arrays.asList(foo.getName(), bar.getName())); assertThat(this.testee.getCodeUnderTestNames()).containsOnly(ClassName.fromString("Foo") , ClassName.fromString("Bar")); }
public List<ClassInfo> getTests() { return this.classPath.test().stream() .flatMap(nameToClassInfo()) .filter(ClassInfo.matchIfAbstract().negate()) .collect(Collectors.toList()); }
public CodeSource(final ProjectClassPaths classPath) { this(classPath, new Repository(new ClassPathByteArraySource( classPath.getClassPath()))); }
Prelude.not(new DefaultDependencyPathPredicate()), Prelude.not(new DefaultDependencyPathPredicate())); final ProjectClassPaths cps = new ProjectClassPaths(data.getClassPath(), data.createClassesFilter(), pf);
public Collection<ClassInfo> getCode() { return this.classPath.code().stream() .flatMap(nameToClassInfo()) .collect(Collectors.toList()); }