You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but it's checking only the first element of the list. With this check a List<Object> can be added if only the first element is a Value while the other aren't.
In my opinion this test must pass, but it fails because the exception isn't thrown
@TestpublicvoidlistMustContainOnlyValues() {
Stringitem = "item";
List<Object> list = newArrayList<>();
list.add(newValue(item));
list.add(item);
try {
newValue((Object) list);
fail("Should fail because list contains values and non-values and the exception should be thrown.");
} catch (InstantiationExceptione) {
assertEquals("Invalid value type: class java.util.ArrayList", e.getMessage());
}
}
Maybe the constructor with Object parameter shouldn't accept lists to force the use of constructor with List<Value> where the list will only contain elements of type Value
java-sdk/src/main/java/dev/openfeature/sdk/Value.java
Lines 133 to 137 in ed2e963
This method
isList()
is used in constructorjava-sdk/src/main/java/dev/openfeature/sdk/Value.java
Line 37 in ed2e963
List<Object>
can be added if only the first element is aValue
while the other aren't.In my opinion this test must pass, but it fails because the exception isn't thrown
Maybe the constructor with
Object
parameter shouldn't accept lists to force the use of constructor withList<Value>
where the list will only contain elements of typeValue
java-sdk/src/main/java/dev/openfeature/sdk/Value.java
Lines 75 to 77 in ed2e963
The text was updated successfully, but these errors were encountered: