@@ -32,14 +32,13 @@ CoberturaParser createParser() {
3232 void shouldIgnoreMissingConditionAttribute () {
3333 Node duplicateMethods = readReport ("cobertura-missing-condition-coverage.xml" );
3434
35- assertThat (duplicateMethods .getAll (FILE )).extracting (Node ::getName )
36- .containsExactly ("DataSourceProvider.cs" );
37- assertThat (duplicateMethods .getAll (CLASS )).extracting (Node ::getName )
38- .containsExactly ("VisualOn.Data.DataSourceProvider" );
39- assertThat (duplicateMethods .getAll (METHOD )).extracting (Node ::getName )
40- .containsExactly ("Enumerate()" );
35+ verifySmallTree (duplicateMethods );
4136 assertThat (getLog ().hasErrors ()).isFalse ();
4237
38+ verifyBranchCoverageOfLine61 (duplicateMethods );
39+ }
40+
41+ private void verifyBranchCoverageOfLine61 (final Node duplicateMethods ) {
4342 var file = duplicateMethods .getAllFileNodes ().get (0 );
4443 assertThat (file .getCoveredOfLine (61 )).isEqualTo (2 );
4544 assertThat (file .getMissedOfLine (61 )).isEqualTo (0 );
@@ -49,19 +48,24 @@ void shouldIgnoreMissingConditionAttribute() {
4948 void shouldIgnoreDuplicateMethods () {
5049 Node duplicateMethods = readReport ("cobertura-duplicate-methods.xml" , new CoberturaParser (true ));
5150
51+ verifySmallTree (duplicateMethods );
52+ assertThat (getLog ().hasErrors ()).isTrue ();
53+ assertThat (getLog ().getErrorMessages ())
54+ .contains ("Skipping duplicate method 'VisualOn.Data.DataSourceProvider' for class 'Enumerate()'" );
55+
56+ verifyBranchCoverageOfLine61 (duplicateMethods );
57+
58+ assertThatIllegalArgumentException ().isThrownBy (
59+ () -> readReport ("cobertura-duplicate-methods.xml" , new CoberturaParser ()));
60+ }
61+
62+ private void verifySmallTree (final Node duplicateMethods ) {
5263 assertThat (duplicateMethods .getAll (FILE )).extracting (Node ::getName )
5364 .containsExactly ("DataSourceProvider.cs" );
5465 assertThat (duplicateMethods .getAll (CLASS )).extracting (Node ::getName )
5566 .containsExactly ("VisualOn.Data.DataSourceProvider" );
5667 assertThat (duplicateMethods .getAll (METHOD )).extracting (Node ::getName )
5768 .containsExactly ("Enumerate()" );
58- assertThat (getLog ().hasErrors ()).isTrue ();
59- assertThat (getLog ().getErrorMessages ())
60- .contains ("Skipping duplicate method 'VisualOn.Data.DataSourceProvider' for class 'Enumerate()'" );
61-
62- var file = duplicateMethods .getAllFileNodes ().get (0 );
63- assertThat (file .getCoveredOfLine (61 )).isEqualTo (2 );
64- assertThat (file .getMissedOfLine (61 )).isEqualTo (0 );
6569 }
6670
6771 @ Test
0 commit comments