use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method create_shouldSetupOwner_for_store_admin.
@Test
public void create_shouldSetupOwner_for_store_admin() {
tester.setStoreAdminUser();
Category category = new Category("name", "");
Category actualCategory = tester.test_create(category);
assertThat(actualCategory).isNotNull();
assertThat(actualCategory.getOwner()).isEqualTo(TestCatalog.OWNER);
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method find_idOfCategoryWithPresentation_WithNoLocaleSpecifiedShouldReturnFallbackLocalePresentation.
@Test
public void find_idOfCategoryWithPresentation_WithNoLocaleSpecifiedShouldReturnFallbackLocalePresentation() {
tester.setPublicUser();
Category category = localService.find(tester.getSecurityContext(), tester.getFixtures().aCategoryWithPresentation().getId(), null);
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_shouldPersist.
@Test
public void create_shouldPersist() {
Category category = new Category("name", "description", new Date(), new Date(), false);
entityManager.getTransaction().begin();
service.create(category);
entityManager.getTransaction().commit();
assertThat(entityManager.find(Category.class, category.getId())).isNotNull();
entityManager.remove(category);
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method modifyCategory_ShouldModifyCategoryAttributesAndPreserveCategoriesWhenNotProvided.
@Test
public void modifyCategory_ShouldModifyCategoryAttributesAndPreserveCategoriesWhenNotProvided() {
tester.setAdminUser();
Category category = new Category(tester.getFixtures().aRootCategoryWithChildCategories().getId(), "New name");
tester.test_modify(category);
assertThat(category.getName()).isEqualTo("New name");
assertThat(category.getChildCategories()).isNotEmpty();
}
use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.
the class CategoriesCT method delete_shouldRemove.
@Test
public void delete_shouldRemove() {
tester.setStoreAdminUser();
Category category = new Category("Test category", "");
category.setOwner(TestCatalog.OWNER);
tester.test_delete(category);
assertThat(tester.getEntityManager().find(Category.class, category.getId())).isNull();
}
Aggregations