Test that `SuggestedFixes.replaceIncludingComments` removes Markdown Javadoc. kak@ points out that this may have been addressed way back in https://github.com/google/error-prone/commit/2dde25434696cc2f87e76b64bf60d8875da36a09. PiperOrigin-RevId: 943937282
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java index 27e4843..f52abd9 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java
@@ -254,6 +254,44 @@ } @Test + public void removal_markdownJavadocs() { + refactoringHelper + .addInputLines( + "UnusedWithComment.java", + """ + package unusedvars; + + public class UnusedWithComment { + /// Method comment + private void test1() {} + + /// First line of method comment + /// Second line of method comment + private void test2() {} + + // Keep this comment + + /// First line of method comment + /// + /// Second line of method comment + private void test3() {} + } + """) + .addOutputLines( + "UnusedWithComment.java", + """ + package unusedvars; + + public class UnusedWithComment { + + // Keep this comment + + } + """) + .doTest(); + } + + @Test public void usedInLambda() { helper .addSourceLines(