use of io.syndesis.common.model.Violation in project syndesis by syndesisio.
the class UpdaterITCase method updaterShouldValidateAfterPatching.
@Test
public void updaterShouldValidateAfterPatching() {
dataManager.create(new Integration.Builder().name("Existing integration").build());
final Integration integration = new Integration.Builder().name("New integration").build();
final ResponseEntity<Integration> created = post("/api/v1/integrations", integration, Integration.class, tokenRule.validToken(), HttpStatus.OK);
final String integrationId = created.getBody().getId().get();
final ResponseEntity<List<Violation>> response = patch("/api/v1/integrations/" + integrationId, Collections.singletonMap("name", "Existing integration"), new ParameterizedTypeReference<List<Violation>>() {
}, tokenRule.validToken(), HttpStatus.BAD_REQUEST);
assertThat(response.getBody()).containsOnly(new Violation.Builder().error("UniqueProperty").property("name").message("Value 'Existing integration' is not unique").build());
}
Aggregations