Skip to content
Snippets Groups Projects
Commit 38068155 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4717 PR#23 Comments

parent d84fc6ae
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@ import lombok.SneakyThrows;
@ITCase
@AutoConfigureMockMvc
@WithMockUser
public class ExceptionControllerITCase {
class ExceptionControllerITCase {
@Autowired
private MockMvc mockMvc;
......@@ -82,8 +82,7 @@ public class ExceptionControllerITCase {
@SneakyThrows
void shouldHaveInfoInBody() {
when(modelAssembler.toModel(any())).thenAnswer((a) -> {
var validationObject = ValidatedClass.builder().build();
throw new ConstraintViolationException(getConstraintViolations(validationObject));
throw new ConstraintViolationException(getConstraintViolations());
});
var result = performGet();
......@@ -91,9 +90,9 @@ public class ExceptionControllerITCase {
assertThat(result.andReturn().getResponse().getContentAsString()).contains("string: Empty field");
}
private <T> Set<ConstraintViolation<T>> getConstraintViolations(T object) {
private Set<ConstraintViolation<ValidatedClass>> getConstraintViolations() {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
return validator.validate(object);
return validator.validate(ValidatedClass.builder().build());
}
@Getter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment