Remove flag eval options from provider API
This commit is contained in:
parent
52c97309d2
commit
4ec5258d95
|
|
@ -13,18 +13,13 @@ public interface FeatureProvider {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx,
|
ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx);
|
||||||
FlagEvaluationOptions options);
|
|
||||||
|
|
||||||
ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx,
|
ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx);
|
||||||
FlagEvaluationOptions options);
|
|
||||||
|
|
||||||
ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx,
|
ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx);
|
||||||
FlagEvaluationOptions options);
|
|
||||||
|
|
||||||
ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx,
|
ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx);
|
||||||
FlagEvaluationOptions options);
|
|
||||||
|
|
||||||
ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue,
|
ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue, EvaluationContext ctx);
|
||||||
EvaluationContext invocationContext, FlagEvaluationOptions options);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@ public class NoOpProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx,
|
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) {
|
||||||
FlagEvaluationOptions options) {
|
|
||||||
return ProviderEvaluation.<Boolean>builder()
|
return ProviderEvaluation.<Boolean>builder()
|
||||||
.value(defaultValue)
|
.value(defaultValue)
|
||||||
.variant(PASSED_IN_DEFAULT)
|
.variant(PASSED_IN_DEFAULT)
|
||||||
|
|
@ -31,8 +30,7 @@ public class NoOpProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx,
|
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) {
|
||||||
FlagEvaluationOptions options) {
|
|
||||||
return ProviderEvaluation.<String>builder()
|
return ProviderEvaluation.<String>builder()
|
||||||
.value(defaultValue)
|
.value(defaultValue)
|
||||||
.variant(PASSED_IN_DEFAULT)
|
.variant(PASSED_IN_DEFAULT)
|
||||||
|
|
@ -41,8 +39,7 @@ public class NoOpProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx,
|
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) {
|
||||||
FlagEvaluationOptions options) {
|
|
||||||
return ProviderEvaluation.<Integer>builder()
|
return ProviderEvaluation.<Integer>builder()
|
||||||
.value(defaultValue)
|
.value(defaultValue)
|
||||||
.variant(PASSED_IN_DEFAULT)
|
.variant(PASSED_IN_DEFAULT)
|
||||||
|
|
@ -51,8 +48,7 @@ public class NoOpProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx,
|
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) {
|
||||||
FlagEvaluationOptions options) {
|
|
||||||
return ProviderEvaluation.<Double>builder()
|
return ProviderEvaluation.<Double>builder()
|
||||||
.value(defaultValue)
|
.value(defaultValue)
|
||||||
.variant(PASSED_IN_DEFAULT)
|
.variant(PASSED_IN_DEFAULT)
|
||||||
|
|
@ -62,8 +58,7 @@ public class NoOpProvider implements FeatureProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue,
|
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue,
|
||||||
EvaluationContext invocationContext,
|
EvaluationContext invocationContext) {
|
||||||
FlagEvaluationOptions options) {
|
|
||||||
return ProviderEvaluation.<Structure>builder()
|
return ProviderEvaluation.<Structure>builder()
|
||||||
.value(defaultValue)
|
.value(defaultValue)
|
||||||
.variant(PASSED_IN_DEFAULT)
|
.variant(PASSED_IN_DEFAULT)
|
||||||
|
|
|
||||||
|
|
@ -115,15 +115,15 @@ public class OpenFeatureClient implements Client {
|
||||||
) {
|
) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
return provider.getBooleanEvaluation(key, (Boolean) defaultValue, invocationContext, options);
|
return provider.getBooleanEvaluation(key, (Boolean) defaultValue, invocationContext);
|
||||||
case STRING:
|
case STRING:
|
||||||
return provider.getStringEvaluation(key, (String) defaultValue, invocationContext, options);
|
return provider.getStringEvaluation(key, (String) defaultValue, invocationContext);
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
return provider.getIntegerEvaluation(key, (Integer) defaultValue, invocationContext, options);
|
return provider.getIntegerEvaluation(key, (Integer) defaultValue, invocationContext);
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
return provider.getDoubleEvaluation(key, (Double) defaultValue, invocationContext, options);
|
return provider.getDoubleEvaluation(key, (Double) defaultValue, invocationContext);
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
return provider.getObjectEvaluation(key, (Structure) defaultValue, invocationContext, options);
|
return provider.getObjectEvaluation(key, (Structure) defaultValue, invocationContext);
|
||||||
default:
|
default:
|
||||||
throw new GeneralError("Unknown flag type");
|
throw new GeneralError("Unknown flag type");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,27 +13,27 @@ public class AlwaysBrokenProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) {
|
||||||
throw new NotImplementedException("BORK");
|
throw new NotImplementedException("BORK");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) {
|
||||||
throw new NotImplementedException("BORK");
|
throw new NotImplementedException("BORK");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) {
|
||||||
throw new NotImplementedException("BORK");
|
throw new NotImplementedException("BORK");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) {
|
||||||
throw new NotImplementedException("BORK");
|
throw new NotImplementedException("BORK");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue, EvaluationContext invocationContext, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue, EvaluationContext invocationContext) {
|
||||||
throw new NotImplementedException("BORK");
|
throw new NotImplementedException("BORK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,21 +14,21 @@ public class DoSomethingProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) {
|
||||||
savedContext = ctx;
|
savedContext = ctx;
|
||||||
return ProviderEvaluation.<Boolean>builder()
|
return ProviderEvaluation.<Boolean>builder()
|
||||||
.value(!defaultValue).build();
|
.value(!defaultValue).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) {
|
||||||
return ProviderEvaluation.<String>builder()
|
return ProviderEvaluation.<String>builder()
|
||||||
.value(new StringBuilder(defaultValue).reverse().toString())
|
.value(new StringBuilder(defaultValue).reverse().toString())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) {
|
||||||
savedContext = ctx;
|
savedContext = ctx;
|
||||||
return ProviderEvaluation.<Integer>builder()
|
return ProviderEvaluation.<Integer>builder()
|
||||||
.value(defaultValue * 100)
|
.value(defaultValue * 100)
|
||||||
|
|
@ -36,7 +36,7 @@ public class DoSomethingProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) {
|
||||||
savedContext = ctx;
|
savedContext = ctx;
|
||||||
return ProviderEvaluation.<Double>builder()
|
return ProviderEvaluation.<Double>builder()
|
||||||
.value(defaultValue * 100)
|
.value(defaultValue * 100)
|
||||||
|
|
@ -44,7 +44,7 @@ public class DoSomethingProvider implements FeatureProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue, EvaluationContext invocationContext, FlagEvaluationOptions options) {
|
public ProviderEvaluation<Structure> getObjectEvaluation(String key, Structure defaultValue, EvaluationContext invocationContext) {
|
||||||
savedContext = invocationContext;
|
savedContext = invocationContext;
|
||||||
return ProviderEvaluation.<Structure>builder()
|
return ProviderEvaluation.<Structure>builder()
|
||||||
.value(null)
|
.value(null)
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ public class HookSpecTest implements HookFixtures {
|
||||||
@Test void flag_eval_hook_order() {
|
@Test void flag_eval_hook_order() {
|
||||||
Hook hook = mockBooleanHook();
|
Hook hook = mockBooleanHook();
|
||||||
FeatureProvider provider = mock(FeatureProvider.class);
|
FeatureProvider provider = mock(FeatureProvider.class);
|
||||||
when(provider.getBooleanEvaluation(any(), any(), any(), any()))
|
when(provider.getBooleanEvaluation(any(), any(), any()))
|
||||||
.thenReturn(ProviderEvaluation.<Boolean>builder()
|
.thenReturn(ProviderEvaluation.<Boolean>builder()
|
||||||
.value(true)
|
.value(true)
|
||||||
.build());
|
.build());
|
||||||
|
|
@ -395,7 +395,7 @@ public class HookSpecTest implements HookFixtures {
|
||||||
FlagEvaluationOptions.builder().hook(hook).build());
|
FlagEvaluationOptions.builder().hook(hook).build());
|
||||||
|
|
||||||
order.verify(hook).before(any(), any());
|
order.verify(hook).before(any(), any());
|
||||||
order.verify(provider).getBooleanEvaluation(any(), any(), any(), any());
|
order.verify(provider).getBooleanEvaluation(any(), any(), any());
|
||||||
order.verify(hook).after(any(), any(), any());
|
order.verify(hook).after(any(), any(), any());
|
||||||
order.verify(hook).finallyAfter(any(), any());
|
order.verify(hook).finallyAfter(any(), any());
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +484,7 @@ public class HookSpecTest implements HookFixtures {
|
||||||
when(hook.before(any(), any())).thenReturn(Optional.of(hookCtx));
|
when(hook.before(any(), any())).thenReturn(Optional.of(hookCtx));
|
||||||
|
|
||||||
FeatureProvider provider = mock(FeatureProvider.class);
|
FeatureProvider provider = mock(FeatureProvider.class);
|
||||||
when(provider.getBooleanEvaluation(any(), any(), any(), any())).thenReturn(ProviderEvaluation.<Boolean>builder()
|
when(provider.getBooleanEvaluation(any(), any(), any())).thenReturn(ProviderEvaluation.<Boolean>builder()
|
||||||
.value(true)
|
.value(true)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
|
@ -497,7 +497,7 @@ public class HookSpecTest implements HookFixtures {
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
ArgumentCaptor<EvaluationContext> captor = ArgumentCaptor.forClass(EvaluationContext.class);
|
ArgumentCaptor<EvaluationContext> captor = ArgumentCaptor.forClass(EvaluationContext.class);
|
||||||
verify(provider).getBooleanEvaluation(any(), any(), captor.capture(), any());
|
verify(provider).getBooleanEvaluation(any(), any(), captor.capture());
|
||||||
EvaluationContext ec = captor.getValue();
|
EvaluationContext ec = captor.getValue();
|
||||||
assertEquals("works", ec.getValue("test").asString());
|
assertEquals("works", ec.getValue("test").asString());
|
||||||
assertEquals("exists", ec.getValue("another").asString());
|
assertEquals("exists", ec.getValue("another").asString());
|
||||||
|
|
|
||||||
|
|
@ -7,33 +7,33 @@ import org.junit.jupiter.api.Test;
|
||||||
public class NoOpProviderTest {
|
public class NoOpProviderTest {
|
||||||
@Test void bool() {
|
@Test void bool() {
|
||||||
NoOpProvider p = new NoOpProvider();
|
NoOpProvider p = new NoOpProvider();
|
||||||
ProviderEvaluation<Boolean> eval = p.getBooleanEvaluation("key", true, null, null);
|
ProviderEvaluation<Boolean> eval = p.getBooleanEvaluation("key", true, null);
|
||||||
assertEquals(true, eval.getValue());
|
assertEquals(true, eval.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test void str() {
|
@Test void str() {
|
||||||
NoOpProvider p = new NoOpProvider();
|
NoOpProvider p = new NoOpProvider();
|
||||||
|
|
||||||
ProviderEvaluation<String> eval = p.getStringEvaluation("key", "works", null, null);
|
ProviderEvaluation<String> eval = p.getStringEvaluation("key", "works", null);
|
||||||
assertEquals("works", eval.getValue());
|
assertEquals("works", eval.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test void integer() {
|
@Test void integer() {
|
||||||
NoOpProvider p = new NoOpProvider();
|
NoOpProvider p = new NoOpProvider();
|
||||||
ProviderEvaluation<Integer> eval = p.getIntegerEvaluation("key", 4, null, null);
|
ProviderEvaluation<Integer> eval = p.getIntegerEvaluation("key", 4, null);
|
||||||
assertEquals(4, eval.getValue());
|
assertEquals(4, eval.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test void noOpdouble() {
|
@Test void noOpdouble() {
|
||||||
NoOpProvider p = new NoOpProvider();
|
NoOpProvider p = new NoOpProvider();
|
||||||
ProviderEvaluation<Double> eval = p.getDoubleEvaluation("key", 0.4, null, null);
|
ProviderEvaluation<Double> eval = p.getDoubleEvaluation("key", 0.4, null);
|
||||||
assertEquals(0.4, eval.getValue());
|
assertEquals(0.4, eval.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test void structure() {
|
@Test void structure() {
|
||||||
NoOpProvider p = new NoOpProvider();
|
NoOpProvider p = new NoOpProvider();
|
||||||
Structure s = new Structure();
|
Structure s = new Structure();
|
||||||
ProviderEvaluation<Structure> eval = p.getObjectEvaluation("key", s, null, null);
|
ProviderEvaluation<Structure> eval = p.getObjectEvaluation("key", s, null);
|
||||||
assertEquals(s, eval.getValue());
|
assertEquals(s, eval.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,19 +24,19 @@ public class ProviderSpecTest {
|
||||||
@Specification(number="2.9.1", text="The flag resolution structure SHOULD accept a generic " +
|
@Specification(number="2.9.1", text="The flag resolution structure SHOULD accept a generic " +
|
||||||
"argument (or use an equivalent language feature) which indicates the type of the wrapped value field.")
|
"argument (or use an equivalent language feature) which indicates the type of the wrapped value field.")
|
||||||
@Test void flag_value_set() {
|
@Test void flag_value_set() {
|
||||||
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new EvaluationContext());
|
||||||
assertNotNull(int_result.getValue());
|
assertNotNull(int_result.getValue());
|
||||||
|
|
||||||
ProviderEvaluation<Double> double_result = p.getDoubleEvaluation("key", 0.4, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Double> double_result = p.getDoubleEvaluation("key", 0.4, new EvaluationContext());
|
||||||
assertNotNull(double_result.getValue());
|
assertNotNull(double_result.getValue());
|
||||||
|
|
||||||
ProviderEvaluation<String> string_result = p.getStringEvaluation("key", "works", new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<String> string_result = p.getStringEvaluation("key", "works", new EvaluationContext());
|
||||||
assertNotNull(string_result.getValue());
|
assertNotNull(string_result.getValue());
|
||||||
|
|
||||||
ProviderEvaluation<Boolean> boolean_result = p.getBooleanEvaluation("key", false, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Boolean> boolean_result = p.getBooleanEvaluation("key", false, new EvaluationContext());
|
||||||
assertNotNull(boolean_result.getValue());
|
assertNotNull(boolean_result.getValue());
|
||||||
|
|
||||||
ProviderEvaluation<Structure> object_result = p.getObjectEvaluation("key", new Structure(), new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Structure> object_result = p.getObjectEvaluation("key", new Structure(), new EvaluationContext());
|
||||||
assertNotNull(object_result.getValue());
|
assertNotNull(object_result.getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -44,14 +44,14 @@ public class ProviderSpecTest {
|
||||||
@Specification(number="2.6", text="The provider SHOULD populate the flag resolution structure's " +
|
@Specification(number="2.6", text="The provider SHOULD populate the flag resolution structure's " +
|
||||||
"reason field with a string indicating the semantic reason for the returned flag value.")
|
"reason field with a string indicating the semantic reason for the returned flag value.")
|
||||||
@Test void has_reason() {
|
@Test void has_reason() {
|
||||||
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new EvaluationContext());
|
||||||
assertEquals(Reason.DEFAULT, result.getReason());
|
assertEquals(Reason.DEFAULT, result.getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Specification(number="2.7", text="In cases of normal execution, the provider MUST NOT populate " +
|
@Specification(number="2.7", text="In cases of normal execution, the provider MUST NOT populate " +
|
||||||
"the flag resolution structure's error code field, or otherwise must populate it with a null or falsy value.")
|
"the flag resolution structure's error code field, or otherwise must populate it with a null or falsy value.")
|
||||||
@Test void no_error_code_by_default() {
|
@Test void no_error_code_by_default() {
|
||||||
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new EvaluationContext());
|
||||||
assertNull(result.getErrorCode());
|
assertNull(result.getErrorCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,16 +63,16 @@ public class ProviderSpecTest {
|
||||||
@Specification(number="2.5", text="In cases of normal execution, the provider SHOULD populate the " +
|
@Specification(number="2.5", text="In cases of normal execution, the provider SHOULD populate the " +
|
||||||
"flag resolution structure's variant field with a string identifier corresponding to the returned flag value.")
|
"flag resolution structure's variant field with a string identifier corresponding to the returned flag value.")
|
||||||
@Test void variant_set() {
|
@Test void variant_set() {
|
||||||
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new EvaluationContext());
|
||||||
assertNotNull(int_result.getReason());
|
assertNotNull(int_result.getReason());
|
||||||
|
|
||||||
ProviderEvaluation<Double> double_result = p.getDoubleEvaluation("key", 0.4, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Double> double_result = p.getDoubleEvaluation("key", 0.4, new EvaluationContext());
|
||||||
assertNotNull(double_result.getReason());
|
assertNotNull(double_result.getReason());
|
||||||
|
|
||||||
ProviderEvaluation<String> string_result = p.getStringEvaluation("key", "works", new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<String> string_result = p.getStringEvaluation("key", "works", new EvaluationContext());
|
||||||
assertNotNull(string_result.getReason());
|
assertNotNull(string_result.getReason());
|
||||||
|
|
||||||
ProviderEvaluation<Boolean> boolean_result = p.getBooleanEvaluation("key", false, new EvaluationContext(), FlagEvaluationOptions.builder().build());
|
ProviderEvaluation<Boolean> boolean_result = p.getBooleanEvaluation("key", false, new EvaluationContext());
|
||||||
assertNotNull(boolean_result.getReason());
|
assertNotNull(boolean_result.getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue