Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve contrib guide #863

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading