[SUREFIRE-2090] Xref link to source code with specified line number doesn't work. Missing "L" in anchor
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
index 4febdd1..b4d9d24 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
@@ -608,7 +608,7 @@
if ( xrefLocation != null )
{
String path = fullClassName.replace( '.', '/' );
- sink.link( xrefLocation + "/" + path + ".html#" + errorLineNumber );
+ sink.link( xrefLocation + "/" + path + ".html#L" + errorLineNumber );
}
sink.text( fullClassName + ":" + errorLineNumber );
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
index 4fa4298..d0cde71 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
@@ -170,7 +170,7 @@
String htmlContent = FileUtils.fileRead( report );
- int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#44" );
+ int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#L44" );
assertTrue( idx == -1 );
}
@@ -195,7 +195,7 @@
String htmlContent = FileUtils.fileRead( report );
- int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#44" );
+ int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#L44" );
assertTrue( idx < 0 );
}
@@ -276,7 +276,7 @@
assertThat( htmlContent, containsString( ">surefire.MyTest:13</a>" ) );
- assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) );
+ assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#L13" ) );
assertThat( htmlContent, containsString( toSystemNewLine( "<pre>"
+ "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\n"
@@ -361,7 +361,7 @@
assertThat( htmlContent,
containsString( ">surefire.MyTest:13</a>" ) );
- assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) );
+ assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#L13" ) );
assertThat( htmlContent, containsString( toSystemNewLine( "<pre>"
+ "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\n"
@@ -424,7 +424,7 @@
assertThat( htmlContent,
containsString( ">surefire.MyTest:13</a>" ) );
- assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) );
+ assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#L13" ) );
assertThat( htmlContent, containsString( toSystemNewLine( "<pre>"
+ "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\n"
@@ -511,7 +511,7 @@
assertThat( htmlContent, containsString( ">surefire.MyTest$A:45</a>" ) );
- assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#45" ) );
+ assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#L45" ) );
assertThat( htmlContent, containsString( toSystemNewLine( "<pre>"
+ "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\n"
@@ -573,7 +573,7 @@
assertThat( htmlContent, containsString( ">surefire.MyTest$A:45</a>" ) );
- assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#45" ) );
+ assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#L45" ) );
assertThat( htmlContent, containsString( toSystemNewLine(
"<pre>" + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\n"