use of org.rembx.jeeshop.rest.WebApplicationException in project jeeshop by remibantos.
the class DiscountsCT method delete_shouldThrowForbiddenException_for_store_admin.
@Test
public void delete_shouldThrowForbiddenException_for_store_admin() {
try {
tester.setStoreAdminUser();
Discount discount = new Discount("discount888", "a discount", ORDER, DISCOUNT_RATE, QUANTITY, null, 0.1, 2.0, 1, true, null, null, false, "test@test.com");
tester.test_delete(discount);
fail("Should have throw an exception");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
}
}
use of org.rembx.jeeshop.rest.WebApplicationException in project jeeshop by remibantos.
the class DiscountsCT method modifyUnknownDiscount_ShouldThrowNotFoundException.
@Test
public void modifyUnknownDiscount_ShouldThrowNotFoundException() {
Discount detachedDiscountToModify = new Discount(9999L);
try {
localService.modify(tester.getSecurityContext(), detachedDiscountToModify);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
use of org.rembx.jeeshop.rest.WebApplicationException in project jeeshop by remibantos.
the class ProductsCT method create_withoutOwner_shouldThrow_BadRequest_for_admin.
@Test
public void create_withoutOwner_shouldThrow_BadRequest_for_admin() {
try {
tester.setAdminUser();
Product product = new Product("name");
tester.test_create(product);
fail("Should have thrown an exception");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.BAD_REQUEST);
}
}
use of org.rembx.jeeshop.rest.WebApplicationException in project jeeshop by remibantos.
the class ProductsCT method delete_NonManagedEntity_shouldThrow_Forbidden.
@Test
public void delete_NonManagedEntity_shouldThrow_Forbidden() {
try {
tester.setStoreAdminUser();
Product product = new Product("Test", "", null, null, null, "test@test.com");
tester.test_delete(product);
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
}
}
use of org.rembx.jeeshop.rest.WebApplicationException in project jeeshop by remibantos.
the class StoresCT method modify_shouldThrowNotFound_for_store_admin.
@Test
public void modify_shouldThrowNotFound_for_store_admin() {
try {
tester.setStoreAdminUser();
Store store = new Store(666L, "Superstore");
tester.test_modify(store);
fail("Should have throw an exception");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
Aggregations