Closed
Description
java-sdk/src/main/java/dev/openfeature/sdk/Value.java
Lines 133 to 137 in ed2e963
This method isList()
is used in constructor
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
@Test
public void listMustContainOnlyValues() {
String item = "item";
List<Object> list = new ArrayList<>();
list.add(new Value(item));
list.add(item);
try {
new Value((Object) list);
fail("Should fail because list contains values and non-values and the exception should be thrown.");
} catch (InstantiationException e) {
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 75 to 77 in ed2e963
Metadata
Metadata
Assignees
Labels
No labels