Skip to content

Commit

Permalink
Adjust test for array pojo value rename
Browse files Browse the repository at this point in the history
Issue: #187
  • Loading branch information
muehmar committed Jan 23, 2024
1 parent 322c1e8 commit 98eda47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.muehmar.gradle.openapi.util.MapperFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
Expand All @@ -28,8 +27,8 @@ void validate_when_validAdditionalProperty_then_noViolationsAndValueReturned()
ArrayAdditionalPropertiesDto.class);

assertEquals(
Optional.of(new ArrayList<>(Arrays.asList("hello", "world"))),
dto.getAdditionalProperty("data").map(ArrayAdditionalPropertiesPropertyDto::getValue));
Optional.of(Arrays.asList("hello", "world")),
dto.getAdditionalProperty("data").map(ArrayAdditionalPropertiesPropertyDto::getItems));

final Set<ConstraintViolation<ArrayAdditionalPropertiesDto>> violations = validate(dto);

Expand Down Expand Up @@ -61,8 +60,7 @@ void serialize_when_withArrayAsAdditionalProperty_then_correctJson()
.andAllOptionals()
.addAdditionalProperty(
"hello",
new ArrayAdditionalPropertiesPropertyDto(
new ArrayList<>(Collections.singletonList("world"))))
new ArrayAdditionalPropertiesPropertyDto(Collections.singletonList("world")))
.build();

final String json = MAPPER.writeValueAsString(dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void validate_when_pojoArrayAndNotUniqueItems_then_violation() {

assertEquals(1, constraintViolations.size());
assertEquals(
"value does not contain unique items",
"items does not contain unique items",
constraintViolations.stream().findFirst().get().getMessage());
assertFalse(dto.isValid());
}
Expand Down

0 comments on commit 98eda47

Please sign in to comment.