Skip to content

Commit 50b34c8

Browse files
author
Bernd Warmuth
committed
chore: restructured tests into separate packages
Signed-off-by: Bernd Warmuth <[email protected]>
1 parent 250c884 commit 50b34c8

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

src/test/java/dev/openfeature/sdk/e2e/RunCucumberTest.java renamed to src/test/java/dev/openfeature/sdk/e2e/EvaluationTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
import org.junit.platform.suite.api.SelectClasspathResource;
66
import org.junit.platform.suite.api.Suite;
77

8+
import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
89
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
910

1011
@Suite
1112
@IncludeEngines("cucumber")
12-
@SelectClasspathResource("features")
13+
@SelectClasspathResource("features/evaluation.feature")
1314
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
14-
public class RunCucumberTest {
15-
15+
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.sdk.e2e.evaluation")
16+
public class EvaluationTest {
17+
1618
}
19+
20+
21+

src/test/java/dev/openfeature/sdk/e2e/StepDefinitions.java renamed to src/test/java/dev/openfeature/sdk/e2e/evaluation/StepDefinitions.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.openfeature.sdk.e2e;
1+
package dev.openfeature.sdk.e2e.evaluation;
22

33
import dev.openfeature.sdk.Value;
44
import dev.openfeature.sdk.EvaluationContext;
@@ -53,6 +53,7 @@ public class StepDefinitions {
5353
@SneakyThrows
5454
@BeforeAll()
5555
@Given("an openfeature client is registered with cache disabled")
56+
@Given("a provider is registered")
5657
public static void setup() {
5758
Map<String, Flag<?>> flags = buildFlags();
5859
InMemoryProvider provider = new InMemoryProvider(flags);
@@ -67,7 +68,7 @@ public static void setup() {
6768
// boolean value
6869
@When("a boolean flag with key {string} is evaluated with default value {string}")
6970
public void a_boolean_flag_with_key_boolean_flag_is_evaluated_with_default_value_false(String flagKey,
70-
String defaultValue) {
71+
String defaultValue) {
7172
this.booleanFlagValue = client.getBooleanValue(flagKey, Boolean.valueOf(defaultValue));
7273
}
7374

@@ -117,7 +118,7 @@ public void an_object_flag_with_key_is_evaluated_with_a_null_default_value(Strin
117118

118119
@Then("the resolved object value should be contain fields {string}, {string}, and {string}, with values {string}, {string} and {int}, respectively")
119120
public void the_resolved_object_value_should_be_contain_fields_and_with_values_and_respectively(String boolField,
120-
String stringField, String numberField, String boolValue, String stringValue, int numberValue) {
121+
String stringField, String numberField, String boolValue, String stringValue, int numberValue) {
121122
Structure structure = this.objectFlagValue.asStructure();
122123

123124
assertEquals(Boolean.valueOf(boolValue), structure.asMap().get(boolField).asBoolean());
@@ -132,7 +133,7 @@ public void the_resolved_object_value_should_be_contain_fields_and_with_values_a
132133
// boolean details
133134
@When("a boolean flag with key {string} is evaluated with details and default value {string}")
134135
public void a_boolean_flag_with_key_is_evaluated_with_details_and_default_value(String flagKey,
135-
String defaultValue) {
136+
String defaultValue) {
136137
this.booleanFlagDetails = client.getBooleanDetails(flagKey, Boolean.valueOf(defaultValue));
137138
}
138139

@@ -148,13 +149,13 @@ public void the_resolved_boolean_value_should_be_the_variant_should_be_and_the_r
148149
// string details
149150
@When("a string flag with key {string} is evaluated with details and default value {string}")
150151
public void a_string_flag_with_key_is_evaluated_with_details_and_default_value(String flagKey,
151-
String defaultValue) {
152+
String defaultValue) {
152153
this.stringFlagDetails = client.getStringDetails(flagKey, defaultValue);
153154
}
154155

155156
@Then("the resolved string details value should be {string}, the variant should be {string}, and the reason should be {string}")
156157
public void the_resolved_string_value_should_be_the_variant_should_be_and_the_reason_should_be(String expectedValue,
157-
String expectedVariant, String expectedReason) {
158+
String expectedVariant, String expectedReason) {
158159
assertEquals(expectedValue, this.stringFlagDetails.getValue());
159160
assertEquals(expectedVariant, this.stringFlagDetails.getVariant());
160161
assertEquals(expectedReason, this.stringFlagDetails.getReason());
@@ -168,7 +169,7 @@ public void an_integer_flag_with_key_is_evaluated_with_details_and_default_value
168169

169170
@Then("the resolved integer details value should be {int}, the variant should be {string}, and the reason should be {string}")
170171
public void the_resolved_integer_value_should_be_the_variant_should_be_and_the_reason_should_be(int expectedValue,
171-
String expectedVariant, String expectedReason) {
172+
String expectedVariant, String expectedReason) {
172173
assertEquals(expectedValue, this.intFlagDetails.getValue());
173174
assertEquals(expectedVariant, this.intFlagDetails.getVariant());
174175
assertEquals(expectedReason, this.intFlagDetails.getReason());
@@ -182,7 +183,7 @@ public void a_float_flag_with_key_is_evaluated_with_details_and_default_value(St
182183

183184
@Then("the resolved float details value should be {double}, the variant should be {string}, and the reason should be {string}")
184185
public void the_resolved_float_value_should_be_the_variant_should_be_and_the_reason_should_be(double expectedValue,
185-
String expectedVariant, String expectedReason) {
186+
String expectedVariant, String expectedReason) {
186187
assertEquals(expectedValue, this.doubleFlagDetails.getValue());
187188
assertEquals(expectedVariant, this.doubleFlagDetails.getVariant());
188189
assertEquals(expectedReason, this.doubleFlagDetails.getReason());
@@ -217,7 +218,7 @@ public void the_variant_should_be_and_the_reason_should_be(String expectedVarian
217218

218219
@When("context contains keys {string}, {string}, {string}, {string} with values {string}, {string}, {int}, {string}")
219220
public void context_contains_keys_with_values(String field1, String field2, String field3, String field4,
220-
String value1, String value2, Integer value3, String value4) {
221+
String value1, String value2, Integer value3, String value4) {
221222
Map<String, Value> attributes = new HashMap<>();
222223
attributes.put(field1, new Value(value1));
223224
attributes.put(field2, new Value(value2));
@@ -253,7 +254,7 @@ public void the_resolved_flag_value_is_when_the_context_is_empty(String expected
253254
// not found
254255
@When("a non-existent string flag with key {string} is evaluated with details and a default value {string}")
255256
public void a_non_existent_string_flag_with_key_is_evaluated_with_details_and_a_default_value(String flagKey,
256-
String defaultValue) {
257+
String defaultValue) {
257258
notFoundFlagKey = flagKey;
258259
notFoundDefaultValue = defaultValue;
259260
notFoundDetails = client.getStringDetails(notFoundFlagKey, notFoundDefaultValue);
@@ -273,7 +274,7 @@ public void the_reason_should_indicate_an_error_and_the_error_code_should_be_fla
273274
// type mismatch
274275
@When("a string flag with key {string} is evaluated as an integer, with details and a default value {int}")
275276
public void a_string_flag_with_key_is_evaluated_as_an_integer_with_details_and_a_default_value(String flagKey,
276-
int defaultValue) {
277+
int defaultValue) {
277278
typeErrorFlagKey = flagKey;
278279
typeErrorDefaultValue = defaultValue;
279280
typeErrorDetails = client.getIntegerDetails(typeErrorFlagKey, typeErrorDefaultValue);

test-harness

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)