use of io.gravitee.common.http.HttpStatusCode.NOT_FOUND_404 in project gravitee-management-rest-api by gravitee-io.
the class ApiMetricsResourceTest method shouldNotFoundApiWhileGettingApiMetrics.
@Test
public void shouldNotFoundApiWhileGettingApiMetrics() {
// init
ApiEntity userApi = new ApiEntity();
userApi.setId("1");
doReturn(emptySet()).when(apiService).findPublishedByUser(any(), argThat(q -> singletonList(API).equals(q.getIds())));
// test
final Response response = target(API).path("metrics").request().get();
assertEquals(NOT_FOUND_404, response.getStatus());
ErrorResponse errorResponse = response.readEntity(ErrorResponse.class);
List<Error> errors = errorResponse.getErrors();
assertNotNull(errors);
assertEquals(1, errors.size());
Error error = errors.get(0);
assertNotNull(error);
assertEquals("errors.api.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Api [" + API + "] can not be found.", error.getMessage());
}
use of io.gravitee.common.http.HttpStatusCode.NOT_FOUND_404 in project gravitee-management-rest-api by gravitee-io.
the class ApiPlansResourceTest method shouldHaveNotFoundWhileGettingApiPlans.
@Test
public void shouldHaveNotFoundWhileGettingApiPlans() {
// init
ApiEntity userApi = new ApiEntity();
userApi.setId("1");
doReturn(emptySet()).when(apiService).findPublishedByUser(any(), argThat(q -> singletonList(API).equals(q.getIds())));
// test
final Response response = target(API).path("plans").request().get();
assertEquals(NOT_FOUND_404, response.getStatus());
ErrorResponse errorResponse = response.readEntity(ErrorResponse.class);
List<Error> errors = errorResponse.getErrors();
assertNotNull(errors);
assertEquals(1, errors.size());
Error error = errors.get(0);
assertNotNull(error);
assertEquals("errors.api.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Api [" + API + "] can not be found.", error.getMessage());
}
use of io.gravitee.common.http.HttpStatusCode.NOT_FOUND_404 in project gravitee-management-rest-api by gravitee-io.
the class ApiSubscribersResourceTest method shouldNotFoundApiWhileGettingApiSubscribers.
@Test
public void shouldNotFoundApiWhileGettingApiSubscribers() {
// init
ApiEntity userApi = new ApiEntity();
userApi.setId("1");
doReturn(emptySet()).when(apiService).findPublishedByUser(any(), argThat(q -> singletonList(API).equals(q.getIds())));
// test
final Response response = target(API).path("metrics").request().get();
assertEquals(NOT_FOUND_404, response.getStatus());
ErrorResponse errorResponse = response.readEntity(ErrorResponse.class);
List<Error> errors = errorResponse.getErrors();
assertNotNull(errors);
assertEquals(1, errors.size());
Error error = errors.get(0);
assertNotNull(error);
assertEquals("errors.api.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Api [" + API + "] can not be found.", error.getMessage());
}
Aggregations