use of com.teamscale.report.util.ClasspathWildcardIncludeFilter in project teamscale-jacoco-agent by cqse.
the class JaCoCoXmlReportGeneratorTest method testEmptyCoverageFileThrowsException.
@Test
void testEmptyCoverageFileThrowsException() throws IOException {
String testFolderName = "empty-report-handling";
long classId = calculateClassId(testFolderName, "TestClass.class");
assertThatThrownBy(() -> runGenerator(testFolderName, EDuplicateClassFileBehavior.IGNORE, false, new ClasspathWildcardIncludeFilter("some.package.*", null), createDummyDump(classId))).isExactlyInstanceOf(EmptyReportException.class);
}
use of com.teamscale.report.util.ClasspathWildcardIncludeFilter in project teamscale-jacoco-agent by cqse.
the class JaCoCoXmlReportGeneratorTest method testShrinking.
/**
* Ensures that uncovered classes are removed from the report if ignore-uncovered-classes is set.
*/
@Test
void testShrinking() throws Exception {
String testFolderName = "ignore-uncovered-classes";
long classId = calculateClassId(testFolderName, "TestClass.class");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
runGenerator(testFolderName, EDuplicateClassFileBehavior.FAIL, true, new ClasspathWildcardIncludeFilter("*", null), createDummyDump(classId)).copy(stream);
String xmlString = stream.toString(StandardCharsets.UTF_8.name());
assertThat(xmlString).contains("TestClass");
assertThat(xmlString).doesNotContain("TestClassTwo");
}
use of com.teamscale.report.util.ClasspathWildcardIncludeFilter in project teamscale-jacoco-agent by cqse.
the class JaCoCoXmlReportGeneratorTest method testNonShrinking.
/**
* Ensures that uncovered classes are contained in the report if ignore-uncovered-classes is not set.
*/
@Test
void testNonShrinking() throws Exception {
String testFolderName = "ignore-uncovered-classes";
long classId = calculateClassId(testFolderName, "TestClass.class");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
runGenerator(testFolderName, EDuplicateClassFileBehavior.FAIL, false, new ClasspathWildcardIncludeFilter("*", null), createDummyDump(classId)).copy(stream);
String xmlString = stream.toString(StandardCharsets.UTF_8.name());
assertThat(xmlString).contains("TestClassTwo");
}
use of com.teamscale.report.util.ClasspathWildcardIncludeFilter in project teamscale-jacoco-agent by cqse.
the class JaCoCoXmlReportGeneratorTest method testNonEmptyCoverageFileDoesNotThrowException.
@Test
void testNonEmptyCoverageFileDoesNotThrowException() throws IOException, EmptyReportException {
String testFolderName = "empty-report-handling";
long classId = calculateClassId(testFolderName, "TestClass.class");
runGenerator(testFolderName, EDuplicateClassFileBehavior.IGNORE, false, new ClasspathWildcardIncludeFilter("*", null), createDummyDump(classId));
}
use of com.teamscale.report.util.ClasspathWildcardIncludeFilter in project teamscale-jacoco-agent by cqse.
the class JaCoCoTestwiseReportGeneratorTest method runReportGenerator.
private String runReportGenerator(String testDataFolder, String execFileName) throws Exception {
File classFileFolder = useTestFile(testDataFolder);
ClasspathWildcardIncludeFilter includeFilter = new ClasspathWildcardIncludeFilter(null, null);
TestwiseCoverage testwiseCoverage = new JaCoCoTestwiseReportGenerator(Collections.singletonList(classFileFolder), includeFilter, EDuplicateClassFileBehavior.IGNORE, mock(ILogger.class)).convert(useTestFile(execFileName));
return ReportUtils.getTestwiseCoverageReportAsString(generateDummyReportFrom(testwiseCoverage));
}
Aggregations