Skip to content

Commit

Permalink
Fixed CategoryBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
hylkevds committed Sep 8, 2023
1 parent 3c99282 commit 5309c9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ public T allowedValue(final String value) {
}

public T allowedValues(final List<String> values) {
if (getBuildingInstance().getConstraint() == null) {
getBuildingInstance().setConstraint(new AllowedTokens());
AllowedTokens constraint = getBuildingInstance().getConstraint();
if (constraint == null) {
constraint = new AllowedTokens();
getBuildingInstance().setConstraint(constraint);
}
final List<String> value = constraint.getValue();
if (value == null) {
constraint.setValue(values);
} else {
value.addAll(values);
}
getBuildingInstance().getConstraint().getValue().addAll(values);
return getSelf();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,13 +552,13 @@ public void writeTaskingParameter() throws IOException {

final ObjectMapper mapper = ObjectMapperFactory.get();
String json = mapper.writeValueAsString(entity);
assert (jsonEqual(expResult, json));
Assert.assertTrue(jsonEqual(expResult, json));

TaskingCapability parsed = mapper.readValue(expResult, TaskingCapability.class);
Assert.assertEquals(entity, parsed);

String json2 = mapper.writeValueAsString(parsed);
assert (jsonEqual(expResult, json2));
Assert.assertTrue(jsonEqual(expResult, json2));
}

}

0 comments on commit 5309c9f

Please sign in to comment.