Skip to content

Commit

Permalink
feat(test): added failing test for RemoveUnusedLocalVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
shanman190 committed Oct 20, 2024
1 parent b030670 commit 8b1b29b
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,46 @@ void bar() {
);
}

@Test
void removeUnusedLDContextWithBuilder() {
rewriteRun(
// language=java
java(
"""
import com.launchdarkly.sdk.*;
import com.launchdarkly.sdk.server.*;
class Foo {
LDClient client = new LDClient("sdk-key-123abc");
void bar() {
LDContext context = LDContext.builder("context-key-123abc")
.name("Sandy")
.build();
if (client.boolVariation("flag-key-123abc", context, false)) {
// Application code to show the feature
System.out.println("Feature is on");
}
else {
// The code to run if the feature is off
System.out.println("Feature is off");
}
}
}
""",
"""
import com.launchdarkly.sdk.*;
import com.launchdarkly.sdk.server.*;
class Foo {
LDClient client = new LDClient("sdk-key-123abc");
void bar() {
// Application code to show the feature
System.out.println("Feature is on");
}
}
"""
)
);
}

@Test
void enablePermanentlyWithParameters() {
rewriteRun(
Expand Down

0 comments on commit 8b1b29b

Please sign in to comment.