diff --git a/products/feature-flagging/feature-flagging-api/src/main/java/datadog/trace/api/openfeature/DDEvaluator.java b/products/feature-flagging/feature-flagging-api/src/main/java/datadog/trace/api/openfeature/DDEvaluator.java index a0a85f6a9ab..dcfe62db147 100644 --- a/products/feature-flagging/feature-flagging-api/src/main/java/datadog/trace/api/openfeature/DDEvaluator.java +++ b/products/feature-flagging/feature-flagging-api/src/main/java/datadog/trace/api/openfeature/DDEvaluator.java @@ -101,8 +101,8 @@ public ProviderEvaluation evaluate( .build(); } - if (isEmpty(flag.allocations)) { - return error(defaultValue, ErrorCode.GENERAL, "Missing allocations for flag " + flag.key); + if (flag.allocations == null) { + return error(defaultValue, ErrorCode.GENERAL, "Missing allocations for flag " + key); } final Date now = new Date(); diff --git a/products/feature-flagging/feature-flagging-api/src/test/java/datadog/trace/api/openfeature/DDEvaluatorTest.java b/products/feature-flagging/feature-flagging-api/src/test/java/datadog/trace/api/openfeature/DDEvaluatorTest.java index b949dc20956..f13f8d2a2ba 100644 --- a/products/feature-flagging/feature-flagging-api/src/test/java/datadog/trace/api/openfeature/DDEvaluatorTest.java +++ b/products/feature-flagging/feature-flagging-api/src/test/java/datadog/trace/api/openfeature/DDEvaluatorTest.java @@ -13,6 +13,7 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.oneOf; @@ -174,8 +175,8 @@ public void testNoAllocations() { details = evaluator.evaluate(Integer.class, "empty-allocation", 23, ctx); assertThat(details.getValue(), equalTo(23)); - assertThat(details.getReason(), equalTo(ERROR.name())); - assertThat(details.getErrorCode(), equalTo(ErrorCode.GENERAL)); + assertThat(details.getReason(), equalTo(DEFAULT.name())); + assertThat(details.getErrorCode(), nullValue()); } private static Arguments[] flatteningTestCases() {