public static <A, B> List<B> map(final Iterable<? extends A> as, final Function<A, B> f) { final List<B> bs = emptyList(); mapTo(as, f, bs); return bs; }
public static Collection<String> getClassPathElementsAsPaths() { final Set<String> filesAsString = new LinkedHashSet<>(); FCollection.mapTo(getClassPathElementsAsFiles(), file -> file.getPath(), filesAsString); return filesAsString; }
public LoggingCallsFilter(Collection<String> loggingClasses) { FCollection.mapTo(loggingClasses, correctFormat(), this.loggingClasses); }
public Set<ClassName> getCodeUnderTestNames() { final Set<ClassName> codeClasses = new HashSet<>(); FCollection.mapTo(getCode(), ClassInfo.toClassName(), codeClasses); return codeClasses; }
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; }
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(); }
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; }
public PluginFilter(final PluginServices plugin) { FCollection.mapTo(plugin.findClientClasspathPlugins(), classToLocation(), this.includedClassPathElement); }
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; }
public static Collection<File> getClassPathElementsAsFiles() { final Set<File> us = new LinkedHashSet<>(); FCollection.mapTo(getClassPathElementsAsAre(), stringToCanonicalFile(), us); addEntriesFromClasspathManifest(us); return us; }
private Set<String> classesToNames(final Class<?>... classes) { final Set<String> set = new HashSet<>(); FCollection.mapTo(Arrays.asList(classes), classToJvmName(), set); return set; }
public DependencyFilter(PluginServices plugins) { final Iterable<? extends ClientClasspathPlugin> runtimePlugins = plugins .findClientClasspathPlugins(); FCollection.mapTo(runtimePlugins, artifactToPair(), this.groups); findVendorIdForGroups(); }
public void describeFeatures(SideEffect1<Feature> enabled, SideEffect1<Feature> disabled) { final FeatureParser parser = new FeatureParser(); final Collection<ProvidesFeature> available = new ArrayList<>(this.plugins.findInterceptors()); final List<FeatureSetting> settings = parser.parseFeatures(this.options.getFeatures()); final FeatureSelector<ProvidesFeature> selector = new FeatureSelector<>(settings, available); final HashSet<Feature> enabledFeatures = new HashSet<>(); FCollection.mapTo(selector.getActiveFeatures(), toFeature(), enabledFeatures); FCollection.forEach(enabledFeatures, enabled); final HashSet<Feature> disabledFeatures = new HashSet<>(); FCollection.mapTo(available, toFeature(), disabledFeatures); disabledFeatures.removeAll(enabledFeatures); FCollection.forEach(disabledFeatures, disabled); }
private static MutationDetails makeCombinedMutant( final Collection<MutationDetails> value) { final MutationDetails first = value.iterator().next(); final Set<Integer> indexes = new HashSet<>(); mapTo(value, mutationToIndex(), indexes); final MutationIdentifier id = new MutationIdentifier(first.getId() .getLocation(), indexes, first.getId().getMutator()); return new MutationDetails(id, first.getFilename(), first.getDescription(), first.getLineNumber(), first.getBlock()); }
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); }
public static <A, B> List<B> map(final Iterable<? extends A> as, final Function<A, B> f) { final List<B> bs = emptyList(); mapTo(as, f, bs); return bs; }
public Set<ClassName> getCodeUnderTestNames() { final Set<ClassName> codeClasses = new HashSet<>(); FCollection.mapTo(getCode(), ClassInfo.toClassName(), codeClasses); return codeClasses; }
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(); }
public static Collection<File> getClassPathElementsAsFiles() { final Set<File> us = new LinkedHashSet<>(); FCollection.mapTo(getClassPathElementsAsAre(), stringToCanonicalFile(), us); addEntriesFromClasspathManifest(us); return us; }
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; }