public void Maven_Cobertura_EnableCodeCoverageTestForLog4JAppender()
 {
     SetupMocks();
     LoadBuildFile(CodeCoverageTestConstants.LogAppenderPomXml);
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     ccInputs.Add("classfilter", _classFilter);
     enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs));
     VerifyCoberturaCoverageForMaven(checkForPluginManagement: false);
     Assert.Equal(_warnings.Count, 0);
     Assert.Equal(_errors.Count, 0);
 }
 public void Maven_EnableCodeCoverageForCoberturaWhenCodeCoverageIsAlreadyEnabled()
 {
     SetupMocks();
     LoadBuildFile(CodeCoverageTestConstants.PomWithCCCoberturaXml);
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     ccInputs.Add("classfilter", _classFilter);
     enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs));
     VerifyCoberturaCoverageForMaven(verifyVersion: false, verifyUserTag: true, checkForPluginManagement: true, numOfCoberturaPluginsInPluginManagement: 1);
     Assert.Equal(_warnings.Count, 0);
     Assert.Equal(_errors.Count, 0);
 }
 public void Maven_Cobertura_EnableCodeCoverageWithFullClassNameFilters()
 {
     SetupMocks();
     LoadBuildFile(CodeCoverageTestConstants.PomXml);
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     ccInputs.Add("classfilter", "+:app.com.SampleTest,+:app.*.UtilTest,+:app2*,-:app.com.SampleTest,-:app.*.UtilTest,-:app3*");
     enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs));
     VerifyCoberturaCoverageForMaven(includes: "app/com/SampleTest.class,app/*/UtilTest.class,app2*/**", excludes: "app/com/SampleTest.class,app/*/UtilTest.class,app3*/**", verifyVersion: false, checkForPluginManagement: true);
     Assert.Equal(_warnings.Count, 0);
     Assert.Equal(_errors.Count, 0);
 }
 public void Maven_Cobertura_EnableCodeCoverageWithNoIncludeExcludeFilters()
 {
     SetupMocks();
     LoadBuildFile(CodeCoverageTestConstants.PomXml);
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs));
     VerifyCoberturaCoverageForMaven(includes: string.Empty, excludes: string.Empty, verifyVersion: false, numOfInclude: 0, numOfExclude: 0, checkForPluginManagement: true);
     Assert.Equal(_warnings.Count, 0);
     Assert.Equal(_errors.Count, 0);
 }
 public void Maven_Cobertura_EnableCodeCoverageForMultiModulePomWithCCEnabled()
 {
     SetupMocks();
     LoadBuildFile(CodeCoverageTestConstants.PomWithMultiModuleWithCCCoberturaXml);
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     ccInputs.Add("classfilter", _classFilter);
     enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs));
     VerifyCoberturaCoverageForMaven(verifyVersion: false, isMultiModule: true);
     Assert.Equal(_warnings.Count, 0);
     Assert.Equal(_errors.Count, 0);
 }
 public void Maven_Cobertura_EnableCodeCoverageForInvalidBuildFile()
 {
     SetupMocks();
     _sampleBuildFilePath = Path.Combine(Path.GetTempPath(), "pom.xml");
     File.WriteAllText(_sampleBuildFilePath, @"This is not valid xml file contents");
     var enableCodeCoverage = new CodeCoverageEnablerForCoberturaMaven();
     enableCodeCoverage.Initialize(_hc);
     var ccInputs = new Dictionary<string, string>();
     ccInputs.Add("buildfile", _sampleBuildFilePath);
     ccInputs.Add("classfilter", _classFilter);
     Assert.Throws<XmlException>(() => enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Maven", ccInputs)));
 }