Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulj committed Jun 5, 2024
1 parent 0aeb7dd commit 66eb977
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,30 @@ public void suggestedFixHandlesAddition() {
.doTest(BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH);
}

@Test
public void suggestedFixHandlesMethodCalledOnBuilt() {
RefactoringValidator.of(StringBuilderConstantParameters.class, getClass())
.addInputLines(
"Test.java",
"class Test {",
" String f() {",
" return new StringBuilder()",
" .append(\"foo\")",
" .append(\"bar\")",
" .toString()",
" .toLowerCase();",
" }",
"}")
.addOutputLines(
"Test.java",
"class Test {",
" String f() {",
" return (\"foo\" + \"bar\").toLowerCase();",
" }",
"}")
.doTest();
}

@Test
public void negativeDynamicStringBuilder() {
compilationHelper
Expand Down

0 comments on commit 66eb977

Please sign in to comment.