You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/07/10 13:24:33 UTC

[maven-surefire] branch master updated: [SUREFIRE-2090] Xref link to source code with specified line number doesn't work. Missing "L" in anchor

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e5de8f9f  [SUREFIRE-2090] Xref link to source code with specified line number doesn't work. Missing "L" in anchor
0e5de8f9f is described below

commit 0e5de8f9f1351c6e88c31cff99fb7600e86ffe07
Author: Björn Raupach <ra...@posteo.de>
AuthorDate: Sun Jul 10 12:07:40 2022 +0200

     [SUREFIRE-2090] Xref link to source code with specified line number doesn't work. Missing "L" in anchor
---
 .../plugins/surefire/report/SurefireReportGenerator.java   |  2 +-
 .../plugins/surefire/report/SurefireReportMojoTest.java    | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

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 4febdd157..b4d9d2436 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 @@ public final class SurefireReportGenerator
                 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 4fa4298ab..d0cde71ad 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 @@ public class SurefireReportMojoTest
 
         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 @@ public class SurefireReportMojoTest
 
         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 @@ public class SurefireReportMojoTest
 
         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 @@ public class SurefireReportMojoTest
         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 @@ public class SurefireReportMojoTest
         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 @@ public class SurefireReportMojoTest
 
         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 @@ public class SurefireReportMojoTest
 
         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"