in ddm-data-factory-feign-client/it/java/com/epam/digital/data/platform/datafactory/factory/client/DataFactoryFeignClientIT.java [186:208]
void shouldPerformNotFoundException() {
var resource = "testResource";
var id = "testId";
var expectedBody = "{\"code\": \"NOT_FOUND\"}";
var headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("X-Access-Token", "token");
mockExceptionDataFactoryFeignClient(StubRequest.builder()
.path(String.format("/%s/%s", resource, id))
.method(HttpMethod.GET)
.requestHeaders(headers)
.status(404)
.responseHeaders(Map.of("Content-Type", List.of("application/json")))
.responseBody(expectedBody)
.build());
ValidationException exception = assertThrows(ValidationException.class, () -> dataFactoryFeignClient.performGet(resource, id, headers));
assertThat(exception).isNotNull();
assertThat(exception.getCode()).isEqualTo("NOT_FOUND");
assertThat(exception.getDetails().getErrors().get(0).getMessage()).isEqualTo("Ресурс не знайдено");
}