use of io.gravitee.rest.api.portal.rest.model.Error in project gravitee-management-rest-api by gravitee-io.
the class ApiRatingAnswerResourceTest method shouldHaveApiNotFoundWhenDeleteWithFakeApi.
@Test
public void shouldHaveApiNotFoundWhenDeleteWithFakeApi() {
final String fakeId = "fake";
final Response response = target(fakeId).path("ratings").path(RATING).path("answers").path(ANSWER).request().delete();
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 [" + fakeId + "] can not be found.", error.getMessage());
}
use of io.gravitee.rest.api.portal.rest.model.Error in project gravitee-management-rest-api by gravitee-io.
the class ApiRatingAnswerResourceTest method shouldHaveRatingAnswerNotFoundWhenDeleteWithFakeId.
@Test
public void shouldHaveRatingAnswerNotFoundWhenDeleteWithFakeId() {
final String fakeId = "fake";
final Response response = target(API).path("ratings").path(fakeId).path("answers").path(ANSWER).request().delete();
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.rating.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Rating [" + fakeId + "] can not be found on the api [" + API + "]", error.getMessage());
}
use of io.gravitee.rest.api.portal.rest.model.Error in project gravitee-management-rest-api by gravitee-io.
the class ApiRatingAnswerResourceTest method shouldHaveRatingNotFoundWhenDeleteWithFakeRating.
@Test
public void shouldHaveRatingNotFoundWhenDeleteWithFakeRating() {
final String fakeId = "fake";
final Response response = target(API).path("ratings").path(fakeId).path("answers").path(ANSWER).request().delete();
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.rating.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Rating [" + fakeId + "] can not be found on the api [" + API + "]", error.getMessage());
}
use of io.gravitee.rest.api.portal.rest.model.Error in project gravitee-management-rest-api by gravitee-io.
the class ApiRatingResourceTest method shouldHaveRatingNotFoundWhenUpdateWithFakeRatingId.
@Test
public void shouldHaveRatingNotFoundWhenUpdateWithFakeRatingId() {
RatingInput ratingInput = new RatingInput().comment(RATING).value(2);
final String fakeId = "fake";
final Response response = target(API).path("ratings").path(fakeId).request().put(Entity.json(ratingInput));
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.rating.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Rating [" + fakeId + "] can not be found on the api [" + API + "]", error.getMessage());
}
use of io.gravitee.rest.api.portal.rest.model.Error in project gravitee-management-rest-api by gravitee-io.
the class ApiRatingResourceTest method shouldHaveRatingNotFoundWhenDeleteWithFakeRatingId.
@Test
public void shouldHaveRatingNotFoundWhenDeleteWithFakeRatingId() {
final String fakeId = "fake";
final Response response = target(API).path("ratings").path(fakeId).request().delete();
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.rating.notFound", error.getCode());
assertEquals("404", error.getStatus());
assertEquals("Rating [" + fakeId + "] can not be found on the api [" + API + "]", error.getMessage());
}
Aggregations