Skip to content

Commit 517c98f

Browse files
aepfliclaude
andcommitted
feat: Complete cleanup of legacy files and remove Lombok from SDK tests
## Legacy File Cleanup - Remove entire legacy `src/` directory (85+ source files, 100+ test files) - Remove `pom.xml.backup` backup file - Remove orphaned `test_noop_access.java` test file - Cleanup eliminates duplicate code after successful module separation ## SDK Test Lombok Removal (17 files) ### Files with @Getter annotations: - MockHook.java: Added manual getters (isBeforeCalled, isAfterCalled, etc.) - ContextStoringProvider.java: Added manual getEvaluationContext() getter ### Files with @SneakyThrows annotations: - Replaced with proper `throws Exception` declarations in 12 test files: EventProviderTest, TrackingSpecTest, FlagEvaluationSpecTest, EventsTest, FeatureProviderStateManagerTest, HookSpecTest, LoggingHookTest, InMemoryProviderTest, StepDefinitions, TestEventsProvider, ThreadLocalTransactionContextPropagatorTest - DeveloperExperienceTest: Replaced with proper try-catch block ### Files with @UtilityClass annotations: - ProviderFixture.java, TestFlagsUtils.java, ConditionStubber.java: Replaced with private constructors to prevent instantiation ## Results - Project is now completely Lombok-free (both API and SDK modules) - Clean multi-module structure without legacy duplicates - All main source code compiles successfully - Maintains same test functionality with manual implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1d2a4fb commit 517c98f

File tree

165 files changed

+77
-14315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+77
-14315
lines changed

openfeature-sdk/src/test/java/dev/openfeature/sdk/DeveloperExperienceTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.List;
2929
import java.util.Map;
3030
import java.util.Optional;
31-
import lombok.SneakyThrows;
3231
import org.junit.jupiter.api.BeforeEach;
3332
import org.junit.jupiter.api.Test;
3433

@@ -120,13 +119,16 @@ void providerLockedPerTransaction() {
120119
class MutatingHook implements Hook {
121120

122121
@Override
123-
@SneakyThrows
124122
// change the provider during a before hook - this should not impact the evaluation in progress
125123
public Optional before(HookContext ctx, Map hints) {
124+
try {
126125

127-
api.setProviderAndWait(TestEventsProvider.newInitializedTestEventsProvider());
126+
api.setProviderAndWait(TestEventsProvider.newInitializedTestEventsProvider());
128127

129-
return Optional.empty();
128+
return Optional.empty();
129+
} catch (Exception e) {
130+
throw new RuntimeException(e);
131+
}
130132
}
131133
}
132134

openfeature-sdk/src/test/java/dev/openfeature/sdk/EventProviderTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import dev.openfeature.sdk.internal.TriConsumer;
1818
import dev.openfeature.sdk.testutils.TestStackedEmitCallsProvider;
1919
import io.cucumber.java.AfterAll;
20-
import lombok.SneakyThrows;
2120
import org.junit.jupiter.api.BeforeEach;
2221
import org.junit.jupiter.api.DisplayName;
2322
import org.junit.jupiter.api.Test;
@@ -30,8 +29,7 @@ class EventProviderTest {
3029
private TestEventProvider eventProvider;
3130

3231
@BeforeEach
33-
@SneakyThrows
34-
void setup() {
32+
void setup() throws Exception {
3533
eventProvider = new TestEventProvider();
3634
eventProvider.initialize(null);
3735
}
@@ -97,10 +95,9 @@ void doesNotThrowWhenOnEmitSame() {
9795
}
9896

9997
@Test
100-
@SneakyThrows
10198
@Timeout(value = 2, threadMode = Timeout.ThreadMode.SEPARATE_THREAD)
10299
@DisplayName("should not deadlock on emit called during emit")
103-
void doesNotDeadlockOnEmitStackedCalls() {
100+
void doesNotDeadlockOnEmitStackedCalls() throws Exception {
104101
TestStackedEmitCallsProvider provider = new TestStackedEmitCallsProvider();
105102
new DefaultOpenFeatureAPI().setProviderAndWait(provider);
106103
}

openfeature-sdk/src/test/java/dev/openfeature/sdk/EventsTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Arrays;
2424
import java.util.List;
2525
import java.util.function.Consumer;
26-
import lombok.SneakyThrows;
2726
import org.junit.jupiter.api.BeforeEach;
2827
import org.junit.jupiter.api.DisplayName;
2928
import org.junit.jupiter.api.Nested;
@@ -687,8 +686,7 @@ class HandlerRemoval {
687686
text = "The API and client MUST provide a function allowing the removal of event handlers.")
688687
@Test
689688
@DisplayName("should not run removed events")
690-
@SneakyThrows
691-
void removedEventsShouldNotRun() {
689+
void removedEventsShouldNotRun() throws Exception {
692690
final String name = "removedEventsShouldNotRun";
693691
final Consumer<EventDetails> handler1 = mockHandler();
694692
final Consumer<EventDetails> handler2 = mockHandler();

openfeature-sdk/src/test/java/dev/openfeature/sdk/FeatureProviderStateManagerTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import dev.openfeature.api.exceptions.GeneralError;
1616
import java.util.concurrent.atomic.AtomicInteger;
1717
import javax.annotation.Nullable;
18-
import lombok.SneakyThrows;
1918
import org.junit.jupiter.api.BeforeEach;
2019
import org.junit.jupiter.api.Test;
2120

@@ -30,17 +29,15 @@ public void setUp() {
3029
wrapper = new FeatureProviderStateManager(testDelegate);
3130
}
3231

33-
@SneakyThrows
3432
@Test
35-
void shouldOnlyCallInitOnce() {
33+
void shouldOnlyCallInitOnce() throws Exception {
3634
wrapper.initialize(null);
3735
wrapper.initialize(null);
3836
assertThat(testDelegate.initCalled.get()).isOne();
3937
}
4038

41-
@SneakyThrows
4239
@Test
43-
void shouldCallInitTwiceWhenShutDownInTheMeantime() {
40+
void shouldCallInitTwiceWhenShutDownInTheMeantime() throws Exception {
4441
wrapper.initialize(null);
4542
wrapper.shutdown();
4643
wrapper.initialize(null);
@@ -53,21 +50,19 @@ void shouldSetStateToNotReadyAfterConstruction() {
5350
assertThat(wrapper.getState()).isEqualTo(ProviderState.NOT_READY);
5451
}
5552

56-
@SneakyThrows
5753
@Test
5854
@Specification(
5955
number = "1.7.3",
6056
text =
6157
"The client's provider status accessor MUST indicate READY if the initialize function of the associated provider terminates normally.")
62-
void shouldSetStateToReadyAfterInit() {
58+
void shouldSetStateToReadyAfterInit() throws Exception {
6359
assertThat(wrapper.getState()).isEqualTo(ProviderState.NOT_READY);
6460
wrapper.initialize(null);
6561
assertThat(wrapper.getState()).isEqualTo(ProviderState.READY);
6662
}
6763

68-
@SneakyThrows
6964
@Test
70-
void shouldSetStateToNotReadyAfterShutdown() {
65+
void shouldSetStateToNotReadyAfterShutdown() throws Exception {
7166
assertThat(wrapper.getState()).isEqualTo(ProviderState.NOT_READY);
7267
wrapper.initialize(null);
7368
assertThat(wrapper.getState()).isEqualTo(ProviderState.READY);

openfeature-sdk/src/test/java/dev/openfeature/sdk/FlagEvaluationSpecTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.util.List;
3939
import java.util.Map;
4040
import java.util.Optional;
41-
import lombok.SneakyThrows;
4241
import org.junit.jupiter.api.AfterEach;
4342
import org.junit.jupiter.api.BeforeEach;
4443
import org.junit.jupiter.api.Test;
@@ -56,8 +55,7 @@ private Client _client() {
5655
return api.getClient();
5756
}
5857

59-
@SneakyThrows
60-
private Client _initializedClient() {
58+
private Client _initializedClient() throws Exception {
6159
TestEventsProvider provider = new TestEventsProvider();
6260
provider.initialize(null);
6361
api.setProviderAndWait(provider);
@@ -91,13 +89,12 @@ void provider() {
9189
assertThat(api.getProvider()).isEqualTo(mockProvider);
9290
}
9391

94-
@SneakyThrows
9592
@Specification(
9693
number = "1.1.8",
9794
text =
9895
"The API SHOULD provide functions to set a provider and wait for the initialize function to return or throw.")
9996
@Test
100-
void providerAndWait() {
97+
void providerAndWait() throws Exception {
10198
FeatureProvider provider = new TestEventsProvider(500);
10299
api.setProviderAndWait(provider);
103100
Client client = api.getClient();
@@ -110,13 +107,12 @@ void providerAndWait() {
110107
assertThat(client2.getProviderState()).isEqualTo(ProviderState.READY);
111108
}
112109

113-
@SneakyThrows
114110
@Specification(
115111
number = "1.1.8",
116112
text =
117113
"The API SHOULD provide functions to set a provider and wait for the initialize function to return or throw.")
118114
@Test
119-
void providerAndWaitError() {
115+
void providerAndWaitError() throws Exception {
120116
FeatureProvider provider1 = new TestEventsProvider(500, true, "fake error");
121117
assertThrows(GeneralError.class, () -> api.setProviderAndWait(provider1));
122118

@@ -361,9 +357,8 @@ void detail_flags() {
361357
number = "1.5.1",
362358
text =
363359
"The evaluation options structure's hooks field denotes an ordered collection of hooks that the client MUST execute for the respective flag evaluation, in addition to those already configured.")
364-
@SneakyThrows
365360
@Test
366-
void hooks() {
361+
void hooks() throws Exception {
367362
Client c = _initializedClient();
368363
Hook<Boolean> clientHook = mockBooleanHook();
369364
Hook<Boolean> invocationHook = mockBooleanHook();

openfeature-sdk/src/test/java/dev/openfeature/sdk/HookSpecTest.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import java.util.List;
4343
import java.util.Map;
4444
import java.util.Optional;
45-
import lombok.SneakyThrows;
4645
import org.junit.jupiter.api.BeforeEach;
4746
import org.junit.jupiter.api.Test;
4847
import org.mockito.ArgumentCaptor;
@@ -443,9 +442,8 @@ void error_stops_before() {
443442
number = "4.4.6",
444443
text =
445444
"If an error occurs during the evaluation of before or after hooks, any remaining hooks in the before or after stages MUST NOT be invoked.")
446-
@SneakyThrows
447445
@Test
448-
void error_stops_after() {
446+
void error_stops_after() throws Exception {
449447
Hook<Boolean> h = mockBooleanHook();
450448
doThrow(RuntimeException.class).when(h).after(any(), any(), any());
451449
Hook<Boolean> h2 = mockBooleanHook();
@@ -468,9 +466,8 @@ void error_stops_after() {
468466
@Specification(number = "4.5.2", text = "hook hints MUST be passed to each hook.")
469467
@Specification(number = "4.2.2.1", text = "Condition: Hook hints MUST be immutable.")
470468
@Specification(number = "4.5.3", text = "The hook MUST NOT alter the hook hints structure.")
471-
@SneakyThrows
472469
@Test
473-
void hook_hints() {
470+
void hook_hints() throws Exception {
474471
String hintKey = "My hint key";
475472
Client client = getClient(null);
476473
Hook<Boolean> mutatingHook = new BooleanHook() {
@@ -552,7 +549,7 @@ void flag_eval_hook_order() {
552549
number = "4.4.7",
553550
text = "If an error occurs in the before hooks, the default value MUST be returned.")
554551
@Test
555-
void error_hooks__before() {
552+
void error_hooks__before() throws Exception {
556553
Hook hook = mockBooleanHook();
557554
doThrow(RuntimeException.class).when(hook).before(any(), any());
558555
Client client = getClient(TestEventsProvider.newInitializedTestEventsProvider());
@@ -570,7 +567,7 @@ void error_hooks__before() {
570567
number = "4.4.5",
571568
text = "If an error occurs in the before or after hooks, the error hooks MUST be invoked.")
572569
@Test
573-
void error_hooks__after() {
570+
void error_hooks__after() throws Exception {
574571
Hook hook = mockBooleanHook();
575572
doThrow(RuntimeException.class).when(hook).after(any(), any(), any());
576573
Client client = getClient(TestEventsProvider.newInitializedTestEventsProvider());
@@ -584,7 +581,7 @@ void error_hooks__after() {
584581
}
585582

586583
@Test
587-
void erroneous_flagResolution_setsAppropriateFieldsInFlagEvaluationDetails() {
584+
void erroneous_flagResolution_setsAppropriateFieldsInFlagEvaluationDetails() throws Exception {
588585
Hook hook = mockBooleanHook();
589586
doThrow(RuntimeException.class).when(hook).after(any(), any(), any());
590587
String flagKey = "test-flag-key";
@@ -630,7 +627,7 @@ void shortCircuit_flagResolution_runsHooksWithAllFields() {
630627
}
631628

632629
@Test
633-
void successful_flagResolution_setsAppropriateFieldsInFlagEvaluationDetails() {
630+
void successful_flagResolution_setsAppropriateFieldsInFlagEvaluationDetails() throws Exception {
634631
Hook hook = mockBooleanHook();
635632
String flagKey = "test-flag-key";
636633
Client client = getClient(TestEventsProvider.newInitializedTestEventsProvider());
@@ -655,7 +652,7 @@ void successful_flagResolution_setsAppropriateFieldsInFlagEvaluationDetails() {
655652
}
656653

657654
@Test
658-
void multi_hooks_early_out__before() {
655+
void multi_hooks_early_out__before() throws Exception {
659656
Hook<Boolean> hook = mockBooleanHook();
660657
Hook<Boolean> hook2 = mockBooleanHook();
661658
doThrow(RuntimeException.class).when(hook).before(any(), any());
@@ -681,7 +678,7 @@ void multi_hooks_early_out__before() {
681678
text =
682679
"Any `evaluation context` returned from a `before` hook MUST be passed to subsequent `before` hooks (via `HookContext`).")
683680
@Test
684-
void beforeContextUpdated() {
681+
void beforeContextUpdated() throws Exception {
685682
String targetingKey = "test-key";
686683
EvaluationContext ctx = new ImmutableContext(targetingKey);
687684
Hook<Boolean> hook = mockBooleanHook();
@@ -749,7 +746,7 @@ void mergeHappensCorrectly() {
749746
text =
750747
"If a finally hook abnormally terminates, evaluation MUST proceed, including the execution of any remaining finally hooks.")
751748
@Test
752-
void first_finally_broken() {
749+
void first_finally_broken() throws Exception {
753750
Hook hook = mockBooleanHook();
754751
doThrow(RuntimeException.class).when(hook).before(any(), any());
755752
doThrow(RuntimeException.class).when(hook).finallyAfter(any(), any(), any());
@@ -773,7 +770,7 @@ void first_finally_broken() {
773770
text =
774771
"If an error hook abnormally terminates, evaluation MUST proceed, including the execution of any remaining error hooks.")
775772
@Test
776-
void first_error_broken() {
773+
void first_error_broken() throws Exception {
777774
Hook hook = mockBooleanHook();
778775
doThrow(RuntimeException.class).when(hook).before(any(), any());
779776
doThrow(RuntimeException.class).when(hook).error(any(), any(), any());
@@ -792,7 +789,7 @@ void first_error_broken() {
792789
order.verify(hook).error(any(), any(), any());
793790
}
794791

795-
private Client getClient(FeatureProvider provider) {
792+
private Client getClient(FeatureProvider provider) throws Exception {
796793
if (provider == null) {
797794
api.setProviderAndWait(TestEventsProvider.newInitializedTestEventsProvider());
798795
} else {
@@ -806,9 +803,8 @@ private Client getClient(FeatureProvider provider) {
806803
void default_methods_so_impossible() {}
807804

808805
@Specification(number = "4.3.9.1", text = "Instead of finally, finallyAfter SHOULD be used.")
809-
@SneakyThrows
810806
@Test
811-
void doesnt_use_finally() {
807+
void doesnt_use_finally() throws Exception {
812808
assertThatCode(() -> Hook.class.getMethod("finally", HookContext.class, Map.class))
813809
.as("Not possible. Finally is a reserved word.")
814810
.isInstanceOf(NoSuchMethodException.class);

openfeature-sdk/src/test/java/dev/openfeature/sdk/ThreadLocalTransactionContextPropagatorTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import dev.openfeature.api.ImmutableContext;
99
import java.util.concurrent.Callable;
1010
import java.util.concurrent.FutureTask;
11-
import lombok.SneakyThrows;
1211
import org.junit.jupiter.api.Test;
1312

1413
public class ThreadLocalTransactionContextPropagatorTest {
@@ -32,9 +31,8 @@ public void emptyTransactionContext() {
3231
assertNull(result);
3332
}
3433

35-
@SneakyThrows
3634
@Test
37-
public void setTransactionContextTwoThreads() {
35+
public void setTransactionContextTwoThreads() throws Exception {
3836
EvaluationContext firstContext = new ImmutableContext();
3937
EvaluationContext secondContext = new ImmutableContext();
4038

openfeature-sdk/src/test/java/dev/openfeature/sdk/TrackingSpecTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import dev.openfeature.sdk.fixtures.ProviderFixture;
2929
import java.util.HashMap;
3030
import java.util.Map;
31-
import lombok.SneakyThrows;
3231
import org.junit.jupiter.api.BeforeEach;
3332
import org.junit.jupiter.api.Test;
3433

@@ -54,8 +53,7 @@ void getApiInstance() {
5453
+ "particular action or application state, with parameters `tracking event name` (string, required) and "
5554
+ "`tracking event details` (optional), which returns nothing.")
5655
@Test
57-
@SneakyThrows
58-
void trackMethodFulfillsSpec() {
56+
void trackMethodFulfillsSpec() throws Exception {
5957

6058
ImmutableContext ctx = new ImmutableContext();
6159
MutableTrackingEventDetails details = new MutableTrackingEventDetails(0.0f);

openfeature-sdk/src/test/java/dev/openfeature/sdk/e2e/ContextStoringProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import dev.openfeature.api.Metadata;
66
import dev.openfeature.api.ProviderEvaluation;
77
import dev.openfeature.api.Value;
8-
import lombok.Getter;
98

10-
@Getter
119
public class ContextStoringProvider implements FeatureProvider {
1210
private EvaluationContext evaluationContext;
1311

@@ -45,4 +43,8 @@ public ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultVa
4543
this.evaluationContext = ctx;
4644
return null;
4745
}
46+
47+
public EvaluationContext getEvaluationContext() {
48+
return evaluationContext;
49+
}
4850
}

0 commit comments

Comments
 (0)