@Test
 public void shouldAcceptCommaSeparatedListOfAdditionalClassPathElements() {
   final ReportOptions ro = parseAddingRequiredArgs("--classPath", "/foo/bar,./boo");
   final Collection<String> actual = ro.getClassPathElements();
   assertTrue(actual.contains("/foo/bar"));
   assertTrue(actual.contains("./boo"));
 }
 @Test
 public void shouldDefaultMutationUnitSizeToCorrectValue() {
   final ReportOptions actual = parseAddingRequiredArgs("");
   assertEquals(
       (int) ConfigOption.MUTATION_UNIT_SIZE.getDefault(Integer.class),
       actual.getMutationUnitSize());
 }
 @Test
 public void shouldUseTargetClassesFilterForTestsWhenNoTargetTestsFilterSupplied() {
   final ReportOptions actual = parseAddingRequiredArgs("--targetClasses", "foo*,bar*");
   final Predicate<String> actualPredicate = actual.getTargetTestsFilter();
   assertTrue(actualPredicate.apply("foo_anything"));
   assertTrue(actualPredicate.apply("bar_anything"));
   assertFalse(actualPredicate.apply("notfoobar"));
 }
 @Test
 public void shouldCreatePredicateFromCommaSeparatedListOfTargetClassGlobs() {
   final ReportOptions actual = parseAddingRequiredArgs("--targetClasses", "foo*,bar*");
   final Predicate<String> actualPredicate = actual.getTargetClassesFilter();
   assertTrue(actualPredicate.apply("foo_anything"));
   assertTrue(actualPredicate.apply("bar_anything"));
   assertFalse(actualPredicate.apply("notfoobar"));
 }
 @Test
 public void shouldParseCommaSeparatedListOfExcludedMethods() {
   final ReportOptions actual = parseAddingRequiredArgs("--excludedMethods", "foo*,bar*,car");
   final Predicate<String> actualPredicate = Prelude.or(actual.getExcludedMethods());
   assertTrue(actualPredicate.apply("foox"));
   assertTrue(actualPredicate.apply("barx"));
   assertTrue(actualPredicate.apply("car"));
   assertFalse(actualPredicate.apply("carx"));
 }
  private void setTestType(final ReportOptions data) {
    final TestGroupConfig conf =
        new TestGroupConfig(this.mojo.getExcludedGroups(), this.mojo.getIncludedGroups());
    final ConfigurationFactory configFactory =
        new ConfigurationFactory(conf, new ClassPathByteArraySource(data.getClassPath()));

    data.setGroupConfig(conf);
    data.setConfiguration(configFactory.createConfiguration());
  }
 @Test
 public void shouldParseCommaSeparatedListOfExcludedClassGlobsAndApplyTheseToTests() {
   final ReportOptions actual =
       parseAddingRequiredArgs(
           "--excludedClasses",
           "foo*",
           "--targetTests",
           "foo*,bar*",
           "--targetClasses",
           "foo*,bar*");
   final Predicate<String> testPredicate = actual.getTargetTestsFilter();
   assertFalse(testPredicate.apply("foo_anything"));
   assertTrue(testPredicate.apply("bar_anything"));
 }
 @Test
 public void shouldParseCommaSeparatedListOfMutationOperators() {
   final ReportOptions actual =
       parseAddingRequiredArgs(
           "--mutators",
           ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.name()
               + ","
               + MathMutator.MATH_MUTATOR.name());
   assertEquals(
       Arrays.asList(
           ConditionalsBoundaryMutator.CONDITIONALS_BOUNDARY_MUTATOR.name(),
           MathMutator.MATH_MUTATOR.name()),
       actual.getMutators());
 }
 @Test
 public void shouldHandleNotCanonicalLaunchClasspathElements() {
   final String oldClasspath = System.getProperty(JAVA_CLASS_PATH_PROPERTY);
   try {
     // given
     final PluginServices plugins = PluginServices.makeForContextLoader();
     this.testee = new OptionsParser(new PluginFilter(plugins));
     // and
     System.setProperty(JAVA_CLASS_PATH_PROPERTY, getNonCanonicalGregorEngineClassPath());
     // when
     final ReportOptions actual = parseAddingRequiredArgs("--includeLaunchClasspath=false");
     // then
     assertThat(actual.getClassPath().findClasses(gregorClass())).hasSize(1);
   } finally {
     System.setProperty(JAVA_CLASS_PATH_PROPERTY, oldClasspath);
   }
 }
 @Test
 public void shouldNotIncludeLaunchClasspathWhenFlagUnset() {
   final ReportOptions actual = parseAddingRequiredArgs("--includeLaunchClasspath=false");
   assertFalse(actual.isIncludeLaunchClasspath());
 }
 @Test
 public void shouldIncludeLaunchClasspathWhenFlag() {
   final ReportOptions actual = parseAddingRequiredArgs("--includeLaunchClasspath=true");
   assertTrue(actual.isIncludeLaunchClasspath());
 }
 @Test
 public void shouldParseMutationUnitSize() {
   final ReportOptions actual = parseAddingRequiredArgs("--mutationUnitSize", "50");
   assertEquals(50, actual.getMutationUnitSize());
 }
 @Test
 public void shouldIncludeLaunchClasspathByDefault() {
   final ReportOptions actual = parseAddingRequiredArgs("");
   assertTrue(actual.isIncludeLaunchClasspath());
 }
 @Test
 public void shouldParseCommaSeparatedListOfSourceDirectories() {
   final ReportOptions actual = parseAddingRequiredArgs("--sourceDirs", "foo/bar,bar/far");
   assertEquals(Arrays.asList(new File("foo/bar"), new File("bar/far")), actual.getSourceDirs());
 }
 @Test
 public void shouldParseCommaSeparatedListOfJVMArgs() {
   final ReportOptions actual = parseAddingRequiredArgs("--jvmArgs", "foo,bar");
   assertEquals(Arrays.asList("foo", "bar"), actual.getJvmArgs());
 }
 @Test
 public void shouldDefaultToHtmlReportWhenNoOutputFormatsSpecified() {
   final ReportOptions actual = parseAddingRequiredArgs();
   assertEquals(new HashSet<String>(Arrays.asList("HTML")), actual.getOutputFormats());
 }
 @Test
 public void shouldDefaultJVMToNull() {
   final ReportOptions actual = parseAddingRequiredArgs();
   assertEquals(null, actual.getJavaExecutable());
 }
 @Test
 public void shouldParseCoverageThreshold() {
   final ReportOptions actual = parseAddingRequiredArgs("--coverageThreshold", "42");
   assertEquals(42, actual.getCoverageThreshold());
 }
 @Test
 public void shouldDefaultToGregorEngineWhenNoOptionSupplied() {
   final ReportOptions actual = parseAddingRequiredArgs();
   assertEquals("gregor", actual.getMutationEngine());
 }
 @Test
 public void shouldParseHistoryOutputLocation() {
   final ReportOptions actual = parseAddingRequiredArgs("--historyOutputLocation", "foo");
   assertEquals(new File("foo"), actual.getHistoryOutputLocation());
 }
 @Test
 public void shouldDefaultToNoHistory() {
   final ReportOptions actual = parseAddingRequiredArgs("");
   assertNull(actual.getHistoryInputLocation());
   assertNull(actual.getHistoryOutputLocation());
 }
 @Test
 public void shouldParseCommaSeparatedListOfOutputFormatsWhenSupplied() {
   final ReportOptions actual = parseAddingRequiredArgs("--outputFormats", "HTML,CSV");
   assertEquals(new HashSet<String>(Arrays.asList("HTML", "CSV")), actual.getOutputFormats());
 }
 @Test
 public void shouldParseReportDir() {
   final String value = "foo";
   final ReportOptions actual = parseAddingRequiredArgs("--reportDir", value);
   assertEquals(value, actual.getReportDir());
 }
 @Test
 public void shouldParseJVM() {
   final ReportOptions actual = parseAddingRequiredArgs("--jvmPath", "foo");
   assertEquals("foo", actual.getJavaExecutable());
 }
 @Test
 public void shouldParseVerboseFlag() {
   final ReportOptions actual = parseAddingRequiredArgs("--verbose");
   assertTrue(actual.isVerbose());
 }
 @Test
 public void shouldParseExportLineCoverageFlag() {
   final ReportOptions actual = parseAddingRequiredArgs("--exportLineCoverage");
   assertTrue(actual.shouldExportLineCoverage());
 }
 @Test
 public void shouldParseMaxDepenencyDistance() {
   final ReportOptions actual = parseAddingRequiredArgs("--dependencyDistance", "42");
   assertEquals(42, actual.getDependencyAnalysisMaxDistance());
 }
 @Test
 public void shouldNotExportLineCoverageWhenFlagNotSet() {
   final ReportOptions actual = parseAddingRequiredArgs("");
   assertFalse(actual.shouldExportLineCoverage());
 }
 @Test
 public void shouldParseMutationEnigne() {
   final ReportOptions actual = parseAddingRequiredArgs("--mutationEngine", "foo");
   assertEquals("foo", actual.getMutationEngine());
 }
 @Test
 public void shouldParseCommaSeparatedListOfIncludedTestGroups() {
   final ReportOptions actual = parseAddingRequiredArgs("--includedGroups", "foo,bar");
   assertEquals(Arrays.asList("foo", "bar"), actual.getGroupConfig().getIncludedGroups());
 }