Skip to content

Commit

Permalink
Apply eclipse cleanup to add java 6 compliant override annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoles committed Jul 29, 2015
1 parent 23731cd commit f6ebe06
Show file tree
Hide file tree
Showing 605 changed files with 6,948 additions and 5,732 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package org.pitest.mutationtest.commandline;

import java.util.HashMap;

import org.pitest.coverage.CoverageSummary;
import org.pitest.mutationtest.config.PluginServices;
import org.pitest.mutationtest.config.ReportOptions;
Expand All @@ -23,8 +25,6 @@
import org.pitest.mutationtest.tooling.EntryPoint;
import org.pitest.util.Unchecked;

import java.util.HashMap;

/**
* Entry point for command line interface
*/
Expand All @@ -44,18 +44,19 @@ public static void main(final String[] args) {

final CombinedStatistics stats = runReport(data, plugins);

throwErrorIfScoreBelowCoverageThreshold(stats.getCoverageSummary(), data.getCoverageThreshold());
throwErrorIfScoreBelowMutationThreshold(stats.getMutationStatistics(), data.getMutationThreshold());
throwErrorIfScoreBelowCoverageThreshold(stats.getCoverageSummary(),
data.getCoverageThreshold());
throwErrorIfScoreBelowMutationThreshold(stats.getMutationStatistics(),
data.getMutationThreshold());
}

}

private static void throwErrorIfScoreBelowCoverageThreshold(
CoverageSummary stats, int threshold) {
if ((threshold != 0) && (stats.getCoverage() < threshold)) {
throw new RuntimeException("Line coverage of "
+ stats.getCoverage() + " is below threshold of "
+ threshold);
throw new RuntimeException("Line coverage of " + stats.getCoverage()
+ " is below threshold of " + threshold);
}
}

Expand All @@ -68,10 +69,12 @@ private static void throwErrorIfScoreBelowMutationThreshold(
}
}

private static CombinedStatistics runReport(ReportOptions data, PluginServices plugins) {
private static CombinedStatistics runReport(ReportOptions data,
PluginServices plugins) {

EntryPoint e = new EntryPoint();
AnalysisResult result = e.execute(null, data, plugins,new HashMap<String, String>());
AnalysisResult result = e.execute(null, data, plugins,
new HashMap<String, String>());
if (result.getError().hasSome()) {
throw Unchecked.translateCheckedException(result.getError().value());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Henry Coles
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -111,7 +111,7 @@ public class OptionsParser {
private final ArgumentAcceptingOptionSpec<Boolean> exportLineCoverageSpec;
private final OptionSpec<String> javaExecutable;
private final OptionSpec<KeyValuePair> pluginPropertiesSpec;

private final ArgumentAcceptingOptionSpec<Boolean> includeLaunchClasspathSpec;

public OptionsParser(Predicate<String> dependencyFilter) {
Expand All @@ -124,14 +124,13 @@ public OptionsParser(Predicate<String> dependencyFilter) {
this.reportDirSpec = parserAccepts(REPORT_DIR).withRequiredArg()
.describedAs("directory to create report folder in").required();


this.targetClassesSpec = parserAccepts(TARGET_CLASSES)
.withRequiredArg()
.ofType(String.class)
.withValuesSeparatedBy(',')
.describedAs(
"comma separated list of filters to match against classes to test")
.required();
.required();

this.avoidCallsSpec = parserAccepts(AVOID_CALLS)
.withRequiredArg()
Expand Down Expand Up @@ -236,7 +235,7 @@ public OptionsParser(Predicate<String> dependencyFilter) {
.withValuesSeparatedBy(',')
.describedAs(
"comma separated list of listeners to receive mutation results")
.defaultsTo("HTML");
.defaultsTo("HTML");

this.additionalClassPathSpec = parserAccepts(CLASSPATH).withRequiredArg()
.ofType(String.class).withValuesSeparatedBy(',')
Expand Down Expand Up @@ -266,7 +265,7 @@ public OptionsParser(Predicate<String> dependencyFilter) {
.ofType(Integer.class)
.describedAs(
"Maximum number of mutations to include within a single unit of analysis")
.defaultsTo(MUTATION_UNIT_SIZE.getDefault(Integer.class));
.defaultsTo(MUTATION_UNIT_SIZE.getDefault(Integer.class));

this.historyInputSpec = parserAccepts(HISTORY_INPUT_LOCATION)
.withRequiredArg().ofType(File.class)
Expand All @@ -292,9 +291,9 @@ public OptionsParser(Predicate<String> dependencyFilter) {

this.javaExecutable = parserAccepts(JVM_PATH).withRequiredArg()
.ofType(String.class).describedAs("path to java executable");
this.pluginPropertiesSpec = parserAccepts(PLUGIN_CONFIGURATION).withRequiredArg()
.ofType(KeyValuePair.class)

this.pluginPropertiesSpec = parserAccepts(PLUGIN_CONFIGURATION)
.withRequiredArg().ofType(KeyValuePair.class)
.describedAs("custom plugin properties");

}
Expand All @@ -316,7 +315,7 @@ public ParseResult parse(final String[] args) {

/**
* Creates a new ParseResult object using the command line arguments.
*
*
* @param data
* the ReportOptions to populate.
* @param userArgs
Expand Down Expand Up @@ -369,7 +368,8 @@ private ParseResult parseCommandLine(final ReportOptions data,
data.setMutationThreshold(this.mutationThreshHoldSpec.value(userArgs));
data.setCoverageThreshold(this.coverageThreshHoldSpec.value(userArgs));
data.setMutationEngine(this.mutationEngine.value(userArgs));
data.setFreeFormProperties(listToProperties(this.pluginPropertiesSpec.values(userArgs)));
data.setFreeFormProperties(listToProperties(this.pluginPropertiesSpec
.values(userArgs)));

data.setExportLineCoverage(userArgs.has(this.exportLineCoverageSpec)
&& userArgs.valueOf(this.exportLineCoverageSpec));
Expand All @@ -392,25 +392,24 @@ private void setClassPath(final OptionSet userArgs, final ReportOptions data) {
if (data.isIncludeLaunchClasspath()) {
elements.addAll(ClassPath.getClassPathElementsAsPaths());
} else {
elements.addAll(FCollection.filter(ClassPath.getClassPathElementsAsPaths(),
dependencyFilter));
elements.addAll(FCollection.filter(
ClassPath.getClassPathElementsAsPaths(), this.dependencyFilter));
}
elements.addAll(userArgs.valuesOf(this.additionalClassPathSpec));
data.setClassPathElements(elements);
}

private void setTestGroups(final OptionSet userArgs,
final ReportOptions data) {
private void setTestGroups(final OptionSet userArgs, final ReportOptions data) {
final TestGroupConfig conf = new TestGroupConfig(
this.excludedGroupsSpec.values(userArgs),
this.includedGroupsSpec.values(userArgs));

data.setGroupConfig(conf);
}

private Properties listToProperties(List<KeyValuePair> kvps) {
Properties p = new Properties();
for ( KeyValuePair kvp : kvps) {
for (KeyValuePair kvp : kvps) {
p.put(kvp.key, kvp.value);
}
return p;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Henry Coles
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public PluginFilter(final PluginServices plugin) {

private static F<ClientClasspathPlugin, String> classToLocation() {
return new F<ClientClasspathPlugin, String>() {
@Override
public String apply(final ClientClasspathPlugin a) {
try {
return new File(a.getClass().getProtectionDomain().getCodeSource()
Expand All @@ -42,6 +43,7 @@ private PitError createPitErrorForExceptionOnClass(final Exception ex,
};
}

@Override
public Boolean apply(final String a) {
return this.includedClassPathElement.contains(a);
}
Expand Down
Loading

0 comments on commit f6ebe06

Please sign in to comment.