Skip to content

Commit

Permalink
chore: improve contrib guide (#863)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Kavindu-Dodan authored Mar 28, 2024
1 parent fb57fab commit 46d04fe
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ be a jerk.

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).

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.
Any contributions you make are expected to be tested with unit tests. You can validate these work with `mvn test`.
Further, it is recommended to verify code styling and static code analysis with `mvn verify -P !deploy`.
Regardless, the automation itself will run them for you when you open a PR.

Your code is supposed to work with Java 8+.

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/openfeature/sdk/OpenFeatureClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public class OpenFeatureClient implements Client {

/**
* Deprecated public constructor. Use OpenFeature.API.getClient() instead.
*
*
* @param openFeatureAPI Backing global singleton
* @param name Name of the client (used by observability tools).
* @param version Version of the client (used by observability tools).
* @deprecated Do not use this constructor. It's for internal use only.
* Clients created using it will not run event handlers.
* Use the OpenFeatureAPI's getClient factory method instead.
*/
@Deprecated() // TODO: eventually we will make this non-public
@Deprecated() // TODO: eventually we will make this non-public. See issue #872
public OpenFeatureClient(OpenFeatureAPI openFeatureAPI, String name, String version) {
this.openfeatureApi = openFeatureAPI;
this.name = name;
Expand Down
35 changes: 17 additions & 18 deletions src/test/java/dev/openfeature/sdk/HookSpecTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package dev.openfeature.sdk;

import dev.openfeature.sdk.fixtures.HookFixtures;
import dev.openfeature.sdk.testutils.FeatureProviderTestUtils;
import lombok.SneakyThrows;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -13,23 +29,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import dev.openfeature.sdk.testutils.FeatureProviderTestUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;

import dev.openfeature.sdk.fixtures.HookFixtures;
import lombok.SneakyThrows;

class HookSpecTest implements HookFixtures {
@AfterEach
void emptyApiHooks() {
Expand Down Expand Up @@ -500,7 +499,7 @@ public void finallyAfter(HookContext<Boolean> ctx, Map<String, Object> hints) {
.hook(hook)
.build());

ArgumentCaptor<MutableContext> captor = ArgumentCaptor.forClass(MutableContext.class);
ArgumentCaptor<ImmutableContext> captor = ArgumentCaptor.forClass(ImmutableContext.class);
verify(provider).getBooleanEvaluation(any(), any(), captor.capture());
EvaluationContext ec = captor.getValue();
assertEquals("works", ec.getValue("test").asString());
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/dev/openfeature/sdk/fixtures/HookFixtures.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package dev.openfeature.sdk.fixtures;

import dev.openfeature.sdk.*;
import dev.openfeature.sdk.BooleanHook;
import dev.openfeature.sdk.DoubleHook;
import dev.openfeature.sdk.Hook;
import dev.openfeature.sdk.IntegerHook;
import dev.openfeature.sdk.StringHook;

import static org.mockito.Mockito.spy;

Expand Down

0 comments on commit 46d04fe

Please sign in to comment.