Skip to content

Commit 6cb3fe4

Browse files
authored
chore: update test annotations, spec badge (#265)
Update the test annotations with new spec verbiage, and update the spec compliance badge. The functional changes have already been merged/released. Signed-off-by: Todd Baert <[email protected]>
1 parent 4d6851a commit 6cb3fe4

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.openfeature/sdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.openfeature/sdk)
44
[![javadoc](https://javadoc.io/badge2/dev.openfeature/sdk/javadoc.svg)](https://javadoc.io/doc/dev.openfeature/sdk)
55
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
6-
[![v0.5.1](https://img.shields.io/static/v1?label=Specification&message=v0.5.1&color=yellow)](https://github.com/open-feature/spec/tree/v0.5.1)
6+
[![Specification](https://img.shields.io/static/v1?label=Specification&message=v0.5.2&color=yellow)](https://github.com/open-feature/spec/tree/v0.5.2)
77
[![Known Vulnerabilities](https://snyk.io/test/github/open-feature/java-sdk/badge.svg)](https://snyk.io/test/github/open-feature/java-sdk)
88
[![on-merge](https://github.com/open-feature/java-sdk/actions/workflows/merge.yml/badge.svg)](https://github.com/open-feature/java-sdk/actions/workflows/merge.yml)
99
[![codecov](https://codecov.io/gh/open-feature/java-sdk/branch/main/graph/badge.svg?token=XMS9L7PBY1)](https://codecov.io/gh/open-feature/java-sdk)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package dev.openfeature.sdk;
2+
23
import static org.junit.jupiter.api.Assertions.assertEquals;
34
import static org.junit.jupiter.api.Assertions.assertNotNull;
45
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -8,22 +9,19 @@
89
public class ProviderSpecTest {
910
NoOpProvider p = new NoOpProvider();
1011

11-
@Specification(number="2.1.1", text="The provider interface MUST define a metadata member or accessor, containing a name field or accessor of type string, which identifies the provider implementation.")
12-
@Test void name_accessor() {
12+
@Specification(number = "2.1.1", text = "The provider interface MUST define a metadata member or accessor, containing a name field or accessor of type string, which identifies the provider implementation.")
13+
@Test
14+
void name_accessor() {
1315
assertNotNull(p.getName());
1416
}
1517

16-
@Specification(number="2.2.2.1", text="The feature provider interface MUST define methods for typed " +
18+
@Specification(number = "2.2.2.1", text = "The feature provider interface MUST define methods for typed " +
1719
"flag resolution, including boolean, numeric, string, and structure.")
18-
@Specification(number="2.2.3", text="In cases of normal execution, the provider MUST populate the " +
19-
"flag resolution structure's value field with the resolved flag value.")
20-
@Specification(number="2.2.1", text="The feature provider interface MUST define methods to resolve " +
21-
"flag values, with parameters flag key (string, required), default value " +
22-
"(boolean | number | string | structure, required) and evaluation context (optional), " +
23-
"which returns a flag resolution structure.")
24-
@Specification(number="2.2.8.1", text="The flag resolution structure SHOULD accept a generic " +
25-
"argument (or use an equivalent language feature) which indicates the type of the wrapped value field.")
26-
@Test void flag_value_set() {
20+
@Specification(number = "2.2.3", text = "In cases of normal execution, the `provider` MUST populate the `resolution details` structure's `value` field with the resolved flag value.")
21+
@Specification(number = "2.2.1", text = "The `feature provider` interface MUST define methods to resolve flag values, with parameters `flag key` (string, required), `default value` (boolean | number | string | structure, required) + and `evaluation context` (optional), which returns a `resolution details` structure.")
22+
@Specification(number = "2.2.8.1", text = "The `resolution details` structure SHOULD accept a generic argument (or use an equivalent language feature) which indicates the type of the wrapped `value` field.")
23+
@Test
24+
void flag_value_set() {
2725
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new MutableContext());
2826
assertNotNull(int_result.getValue());
2927

@@ -41,27 +39,30 @@ public class ProviderSpecTest {
4139

4240
}
4341

44-
@Specification(number="2.2.5", text="The `provider` SHOULD populate the `flag resolution` structure's `reason` field with `\"DEFAULT\",` `\"TARGETING_MATCH\"`, `\"SPLIT\"`, `\"DISABLED\"`, `\"UNKNOWN\"`, `\"ERROR\"` or some other string indicating the semantic reason for the returned flag value.")
45-
@Test void has_reason() {
42+
@Specification(number = "2.2.5", text = "The `provider` SHOULD populate the `resolution details` structure's `reason` field with `\"STATIC\"`, `\"DEFAULT\",` `\"TARGETING_MATCH\"`, `\"SPLIT\"`, `\"CACHED\"`, `\"DISABLED\"`, `\"UNKNOWN\"`, `\"ERROR\"` or some other string indicating the semantic reason for the returned flag value.")
43+
@Test
44+
void has_reason() {
4645
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new MutableContext());
4746
assertEquals(Reason.DEFAULT.toString(), result.getReason());
4847
}
4948

50-
@Specification(number="2.2.6", text="In cases of normal execution, the provider MUST NOT populate " +
51-
"the flag resolution structure's error code field, or otherwise must populate it with a null or falsy value.")
52-
@Test void no_error_code_by_default() {
49+
@Specification(number = "2.2.6", text = "In cases of normal execution, the `provider` MUST NOT populate the `resolution details` structure's `error code` field, or otherwise must populate it with a null or falsy value.")
50+
@Test
51+
void no_error_code_by_default() {
5352
ProviderEvaluation<Boolean> result = p.getBooleanEvaluation("key", false, new MutableContext());
5453
assertNull(result.getErrorCode());
5554
}
5655

57-
@Specification(number="2.2.7", text="In cases of abnormal execution, the `provider` **MUST** indicate an error using the idioms of the implementation language, with an associated `error code` and optional associated `error message`.")
58-
@Specification(number="2.3.2", text="In cases of normal execution, the `provider` **MUST NOT** populate the `flag resolution` structure's `error message` field, or otherwise must populate it with a null or falsy value.")
59-
@Specification(number="2.3.3", text="In cases of abnormal execution, the `evaluation details` structure's `error message` field **MAY** contain a string containing additional detail about the nature of the error.")
60-
@Test void up_to_provider_implementation() {}
56+
@Specification(number = "2.2.7", text = "In cases of abnormal execution, the `provider` **MUST** indicate an error using the idioms of the implementation language, with an associated `error code` and optional associated `error message`.")
57+
@Specification(number = "2.3.2", text = "In cases of normal execution, the `provider` MUST NOT populate the `resolution details` structure's `error message` field, or otherwise must populate it with a null or falsy value.")
58+
@Specification(number = "2.3.3", text = "In cases of abnormal execution, the `resolution details` structure's `error message` field MAY contain a string containing additional detail about the nature of the error.")
59+
@Test
60+
void up_to_provider_implementation() {
61+
}
6162

62-
@Specification(number="2.2.4", text="In cases of normal execution, the provider SHOULD populate the " +
63-
"flag resolution structure's variant field with a string identifier corresponding to the returned flag value.")
64-
@Test void variant_set() {
63+
@Specification(number = "2.2.4", text = "In cases of normal execution, the `provider` SHOULD populate the `resolution details` structure's `variant` field with a string identifier corresponding to the returned flag value.")
64+
@Test
65+
void variant_set() {
6566
ProviderEvaluation<Integer> int_result = p.getIntegerEvaluation("key", 4, new MutableContext());
6667
assertNotNull(int_result.getReason());
6768

@@ -75,9 +76,10 @@ public class ProviderSpecTest {
7576
assertNotNull(boolean_result.getReason());
7677
}
7778

78-
@Specification(number="2.3.1", text="The provider interface MUST define a provider hook mechanism which can be optionally implemented in order to add hook instances to the evaluation life-cycle.")
79-
@Specification(number="4.4.1", text="The API, Client, Provider, and invocation MUST have a method for registering hooks.")
80-
@Test void provider_hooks() {
79+
@Specification(number = "2.3.1", text = "The provider interface MUST define a provider hook mechanism which can be optionally implemented in order to add hook instances to the evaluation life-cycle.")
80+
@Specification(number = "4.4.1", text = "The API, Client, Provider, and invocation MUST have a method for registering hooks.")
81+
@Test
82+
void provider_hooks() {
8183
assertEquals(0, p.getProviderHooks().size());
8284
}
8385
}

0 commit comments

Comments
 (0)