Skip to content

Commit ebb8c58

Browse files
committed
improve contribution guide and remove deprecation
Signed-off-by: Kavindu Dodanduwa <[email protected]>
1 parent d51cacb commit ebb8c58

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ be a jerk.
88

99
We're not keen on vendor-specific stuff in this library, but if there are changes that need to happen in the spec to enable vendor-specific stuff in user code or other extension points, check out [the spec](https://github.com/open-feature/spec).
1010

11-
Any contributions you make are expected to be tested with unit tests. You can validate these work with `gradle test`, or the automation itself will run them for you when you make a PR.
11+
Any contributions you make are expected to be tested with unit tests. You can validate these work with `mvn test`.
12+
Further, it is recommended to verify code styling and static code analysis with `mvn verify -P !deploy`.
13+
Regardless, the automation itself will run them for you when you open a PR.
1214

1315
Your code is supposed to work with Java 8+.
1416

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<dependency>
6868
<groupId>org.mockito</groupId>
6969
<artifactId>mockito-core</artifactId>
70-
<version>4.11.0</version>
70+
<version>5.11.0</version>
7171
<scope>test</scope>
7272
</dependency>
7373

src/main/java/dev/openfeature/sdk/OpenFeatureClient.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,13 @@ public class OpenFeatureClient implements Client {
3434
private EvaluationContext evaluationContext;
3535

3636
/**
37-
* Deprecated public constructor. Use OpenFeature.API.getClient() instead.
38-
*
37+
* Create an OpenFeature client. For internal use only.
38+
*
3939
* @param openFeatureAPI Backing global singleton
4040
* @param name Name of the client (used by observability tools).
4141
* @param version Version of the client (used by observability tools).
42-
* @deprecated Do not use this constructor. It's for internal use only.
43-
* Clients created using it will not run event handlers.
44-
* Use the OpenFeatureAPI's getClient factory method instead.
4542
*/
46-
@Deprecated() // TODO: eventually we will make this non-public
47-
public OpenFeatureClient(OpenFeatureAPI openFeatureAPI, String name, String version) {
43+
OpenFeatureClient(OpenFeatureAPI openFeatureAPI, String name, String version) {
4844
this.openfeatureApi = openFeatureAPI;
4945
this.name = name;
5046
this.version = version;

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

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
package dev.openfeature.sdk;
22

3+
import dev.openfeature.sdk.fixtures.HookFixtures;
4+
import dev.openfeature.sdk.testutils.FeatureProviderTestUtils;
5+
import lombok.SneakyThrows;
6+
import org.junit.jupiter.api.AfterEach;
7+
import org.junit.jupiter.api.Test;
8+
import org.mockito.ArgumentCaptor;
9+
import org.mockito.InOrder;
10+
11+
import java.util.ArrayList;
12+
import java.util.Arrays;
13+
import java.util.Collections;
14+
import java.util.HashMap;
15+
import java.util.List;
16+
import java.util.Map;
17+
import java.util.Optional;
18+
319
import static org.assertj.core.api.Assertions.assertThatCode;
420
import static org.assertj.core.api.Assertions.fail;
521
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -13,23 +29,6 @@
1329
import static org.mockito.Mockito.verify;
1430
import static org.mockito.Mockito.when;
1531

16-
import java.util.ArrayList;
17-
import java.util.Arrays;
18-
import java.util.Collections;
19-
import java.util.HashMap;
20-
import java.util.List;
21-
import java.util.Map;
22-
import java.util.Optional;
23-
24-
import dev.openfeature.sdk.testutils.FeatureProviderTestUtils;
25-
import org.junit.jupiter.api.AfterEach;
26-
import org.junit.jupiter.api.Test;
27-
import org.mockito.ArgumentCaptor;
28-
import org.mockito.InOrder;
29-
30-
import dev.openfeature.sdk.fixtures.HookFixtures;
31-
import lombok.SneakyThrows;
32-
3332
class HookSpecTest implements HookFixtures {
3433
@AfterEach
3534
void emptyApiHooks() {
@@ -500,7 +499,7 @@ public void finallyAfter(HookContext<Boolean> ctx, Map<String, Object> hints) {
500499
.hook(hook)
501500
.build());
502501

503-
ArgumentCaptor<MutableContext> captor = ArgumentCaptor.forClass(MutableContext.class);
502+
ArgumentCaptor<ImmutableContext> captor = ArgumentCaptor.forClass(ImmutableContext.class);
504503
verify(provider).getBooleanEvaluation(any(), any(), captor.capture());
505504
EvaluationContext ec = captor.getValue();
506505
assertEquals("works", ec.getValue("test").asString());

src/test/java/dev/openfeature/sdk/fixtures/HookFixtures.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package dev.openfeature.sdk.fixtures;
22

3-
import dev.openfeature.sdk.*;
3+
import dev.openfeature.sdk.BooleanHook;
4+
import dev.openfeature.sdk.DoubleHook;
5+
import dev.openfeature.sdk.Hook;
6+
import dev.openfeature.sdk.IntegerHook;
7+
import dev.openfeature.sdk.StringHook;
48

59
import static org.mockito.Mockito.spy;
610

0 commit comments

Comments
 (0)