Improve test coverage.
Add a test that checks that issues are stored either in top-level or in sub reports.
@@ -933,6 +933,20 @@ class ReportTest extends SerializableTest<Report> {
"Error message from CheckStyle", "Error message from SpotBugs");
}
+ @Test
+ void shouldStoreEitherInTopLevelOrSubReports() {
+ Report checkStyle = new Report(CHECKSTYLE_ID, CHECKSTYLE_NAME, "checkstyle.xml");
+ checkStyle.add(HIGH);
+
+ Report wrappedCheckStyle = new Report();
+ wrappedCheckStyle.addAll(checkStyle);
+ wrappedCheckStyle.add(LOW_2_A);
+
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> new Report().addAll(wrappedCheckStyle)
+ );
+ }
+
@Test
void shouldAddSubReports() {
try (IssueBuilder builder = new IssueBuilder()) {
