From fdf345b2f1b369f9ee902a4051fb195c2af47d1f Mon Sep 17 00:00:00 2001 From: Adam Birem Date: Wed, 30 Oct 2024 13:37:02 +0100 Subject: [PATCH] Add test case for issue #384 https://github.com/openrewrite/rewrite-static-analysis/issues/384 --- .../ReplaceDuplicateStringLiteralsTest.java | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/openrewrite/staticanalysis/ReplaceDuplicateStringLiteralsTest.java b/src/test/java/org/openrewrite/staticanalysis/ReplaceDuplicateStringLiteralsTest.java index 8fc7e44a8..9e0c02d57 100644 --- a/src/test/java/org/openrewrite/staticanalysis/ReplaceDuplicateStringLiteralsTest.java +++ b/src/test/java/org/openrewrite/staticanalysis/ReplaceDuplicateStringLiteralsTest.java @@ -21,8 +21,7 @@ import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; -import static org.openrewrite.java.Assertions.java; -import static org.openrewrite.java.Assertions.srcTestJava; +import static org.openrewrite.java.Assertions.*; class ReplaceDuplicateStringLiteralsTest implements RewriteTest { @@ -727,4 +726,32 @@ interface A { ) ); } + + @Issue("https://github.com/openrewrite/rewrite-static-analysis/issues/384") + @Test + void staticWithObjectArray() { + rewriteRun( + //language=java + java( + """ + class A { + public void method() { + Object[] args = null; + args = new Object[] {"value"}; + } + } + """, + """ + class A { + public void method() { + Object[] args = null; + args = new Object[] {"value"}; + } + } + """ + ) + ); + } + + }