use of io.gravitee.rest.api.portal.rest.model.ErrorResponse 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