Skip to content

Commit ae0e751

Browse files
committed
Add test for reason field.
1 parent eb476de commit ae0e751

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/src/test/java/dev/openfeature/javasdk/FlagEvaluationSpecTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ Client _client() {
179179
}
180180

181181
@Specification(number="1.4.8", text="In cases of abnormal execution (network failure, unhandled error, etc) the reason field in the evaluation details SHOULD indicate an error.")
182-
@Test @Disabled void question_pending() {}
182+
@Test void reason_is_error_when_there_are_errors() {
183+
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
184+
api.setProvider(new AlwaysBrokenProvider());
185+
Client c = api.getClient();
186+
FlagEvaluationDetails<Boolean> result = c.getBooleanDetails("test", false);
187+
assertEquals(Reason.ERROR, result.getReason());
188+
}
183189

184190
@Specification(number="1.3.3", text="The client SHOULD guarantee the returned value of any typed flag evaluation method is of the expected type. If the value returned by the underlying provider implementation does not match the expected type, it's to be considered abnormal execution, and the supplied default value should be returned.")
185191
@Specification(number="1.1.6", text="The client creation function MUST NOT throw, or otherwise abnormally terminate.")

0 commit comments

Comments
 (0)