use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method find_idOfCategoryWithPresentation_WithNotSupportedLocaleSpecifiedShouldReturnFallbackLocalePresentation.
@Test
public void find_idOfCategoryWithPresentation_WithNotSupportedLocaleSpecifiedShouldReturnFallbackLocalePresentation() {
tester.setPublicUser();
Category category = localService.find(tester.getSecurityContext(), tester.getFixtures().aCategoryWithPresentation().getId(), "it_IT");
assertThat(category).hasLocalizedPresentationShortDescription(Locale.ENGLISH.toString(), PresentationTexts.TEXT_1000);
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method create_withoutOwner_shouldThrow_BadRequestEx_for_admin.
@Test
public void create_withoutOwner_shouldThrow_BadRequestEx_for_admin() {
try {
tester.setAdminUser();
Category category = new Category("name", "description");
tester.test_create(category);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.BAD_REQUEST);
}
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method find_idOfCategoryWithPresentation_ShouldReturnExpectedPresentation.
@Test
public void find_idOfCategoryWithPresentation_ShouldReturnExpectedPresentation() {
tester.setPublicUser();
Category actual = localService.find(tester.getSecurityContext(), tester.getFixtures().aCategoryWithPresentation().getId(), Locale.ENGLISH.toString());
assertThat(actual).hasLocalizedPresentationShortDescription(Locale.ENGLISH.toString(), PresentationTexts.TEXT_1000);
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method modifyUnknownCategory_ShouldThrowNotFoundException.
@Test
public void modifyUnknownCategory_ShouldThrowNotFoundException() {
try {
Category category = new Category(9999L, null);
localService.modify(tester.getSecurityContext(), category);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method create_shouldSetupOwner_for_admin.
@Test
public void create_shouldSetupOwner_for_admin() {
tester.setAdminUser();
Category category = new Category("name", "description", new Date(), new Date(), false, "test@test.com");
category.setOwner(TestCatalog.OWNER);
Category actualCategory = tester.test_create(category);
assertThat(actualCategory).isNotNull();
assertThat(actualCategory.getOwner()).isEqualTo(TestCatalog.OWNER);
}
Aggregations