Java Code Examples for org.pitest.functional.FCollection#mapTo()

The following examples show how to use org.pitest.functional.FCollection#mapTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MutationCoverage.java    From pitest with Apache License 2.0 5 votes vote down vote up
private Set<ClassName> getAllClassesAndTests(
    final CoverageDatabase coverageData) {
  final Set<ClassName> names = new HashSet<>();
  for (final ClassName each : this.code.getCodeUnderTestNames()) {
    names.add(each);
    FCollection.mapTo(coverageData.getTestsForClass(each),
        TestInfo.toDefiningClassName(), names);
  }
  return names;
}
 
Example 2
Source File: FilterTester.java    From pitest with Apache License 2.0 5 votes vote down vote up
public void assertFiltersMutationAtNLocations(int n, Sample s, GregorMutater mutator) {
  final List<MutationDetails> mutations = mutator.findMutations(s.className);
  final Collection<MutationDetails> actual = filter(s.clazz, mutations, mutator);

  final Set<Loc> originalLocations = new LinkedHashSet<>();
  FCollection.mapTo(mutations, toLocation(s.clazz), originalLocations);

  final Set<Loc> filteredLocations = new LinkedHashSet<>();
  FCollection.mapTo(actual, toLocation(s.clazz), filteredLocations);

  assertThat(filteredLocations)
  .describedAs("Expected to filter %d locations from the %d in %s", n, originalLocations.size(), s.clazz.toString())
  .hasSize(originalLocations.size() - n);

}
 
Example 3
Source File: ParameterisedJUnitTestFinder.java    From pitest with Apache License 2.0 5 votes vote down vote up
private List<TestUnit> handleParameterizedTest(final Class<?> clazz,
    final Description description) {
  final List<TestUnit> result = new ArrayList<>();
  for (final Description each : description.getChildren()) {
    FCollection.mapTo(each.getChildren(), parameterizedToTestUnit(clazz),
        result);
  }
  return result;
}
 
Example 4
Source File: ClassPath.java    From pitest with Apache License 2.0 5 votes vote down vote up
public static Collection<File> getClassPathElementsAsFiles() {
  final Set<File> us = new LinkedHashSet<>();
  FCollection.mapTo(getClassPathElementsAsAre(), stringToCanonicalFile(), us);
  
  addEntriesFromClasspathManifest(us);
  return us;
}
 
Example 5
Source File: ScmMojo.java    From pitest with Apache License 2.0 5 votes vote down vote up
private Set<ScmFileStatus> makeStatusSet() {
  if ((this.include == null) || this.include.isEmpty()) {
    return new HashSet<>(Arrays.asList(
        ScmStatus.ADDED.getStatus(), ScmStatus.MODIFIED.getStatus()));
  }
  final Set<ScmFileStatus> s = new HashSet<>();
  FCollection.mapTo(this.include, stringToMavenScmStatus(), s);
  return s;
}
 
Example 6
Source File: MojoToReportOptionsConverter.java    From pitest with Apache License 2.0 5 votes vote down vote up
public static Collection<String> findOccupiedPackagesIn(File dir) {
  if (dir.exists()) {
    DirectoryClassPathRoot root = new DirectoryClassPathRoot(dir);
    Set<String> occupiedPackages = new HashSet<>();
    FCollection.mapTo(root.classNames(), classToPackageGlob(),
        occupiedPackages);
    return occupiedPackages;
  }
  return Collections.emptyList();
}
 
Example 7
Source File: LoggingCallsFilter.java    From pitest with Apache License 2.0 4 votes vote down vote up
public LoggingCallsFilter(Collection<String> loggingClasses) {
  FCollection.mapTo(loggingClasses, correctFormat(), this.loggingClasses);
}
 
Example 8
Source File: CodeSource.java    From pitest with Apache License 2.0 4 votes vote down vote up
public Set<ClassName> getCodeUnderTestNames() {
  final Set<ClassName> codeClasses = new HashSet<>();
  FCollection.mapTo(getCode(), ClassInfo.toClassName(), codeClasses);
  return codeClasses;
}
 
Example 9
Source File: ClassPath.java    From pitest with Apache License 2.0 4 votes vote down vote up
public static Collection<String> getClassPathElementsAsPaths() {
  final Set<String> filesAsString = new LinkedHashSet<>();
  FCollection.mapTo(getClassPathElementsAsFiles(), file -> file.getPath(),
      filesAsString);
  return filesAsString;
}
 
Example 10
Source File: DependencyClassVisitorTest.java    From pitest with Apache License 2.0 4 votes vote down vote up
private Set<String> classesToNames(final Class<?>... classes) {
  final Set<String> set = new HashSet<>();
  FCollection.mapTo(Arrays.asList(classes), classToJvmName(), set);
  return set;
}
 
Example 11
Source File: PluginFilter.java    From pitest with Apache License 2.0 4 votes vote down vote up
public PluginFilter(final PluginServices plugin) {
  FCollection.mapTo(plugin.findClientClasspathPlugins(), classToLocation(),
      this.includedClassPathElement);
}
 
Example 12
Source File: DependencyFilter.java    From pitest with Apache License 2.0 4 votes vote down vote up
public DependencyFilter(PluginServices plugins) {
  final Iterable<? extends ClientClasspathPlugin> runtimePlugins = plugins
      .findClientClasspathPlugins();
  FCollection.mapTo(runtimePlugins, artifactToPair(), this.groups);
  findVendorIdForGroups();
}