Skip to content

Commit 46d04fe

Browse files
chore: improve contrib guide (open-feature#863)
* improve contribution guide and remove deprecation Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com> * revert mockito bump Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com> * revert proposed change Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com> --------- Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
1 parent fb57fab commit 46d04fe

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
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

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ public class OpenFeatureClient implements Client {
3535

3636
/**
3737
* Deprecated public constructor. Use OpenFeature.API.getClient() instead.
38-
*
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).
4242
* @deprecated Do not use this constructor. It's for internal use only.
4343
* Clients created using it will not run event handlers.
4444
* Use the OpenFeatureAPI's getClient factory method instead.
4545
*/
46-
@Deprecated() // TODO: eventually we will make this non-public
46+
@Deprecated() // TODO: eventually we will make this non-public. See issue #872
4747
public OpenFeatureClient(OpenFeatureAPI openFeatureAPI, String name, String version) {
4848
this.openfeatureApi = openFeatureAPI;
4949
this.name = name;

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)