Package de.hybris.platform.category.impl
Class DefaultCategoryServiceDemoTest
- java.lang.Object
-
- de.hybris.platform.testframework.HybrisJUnit4Test
-
- de.hybris.platform.servicelayer.ServicelayerBaseTest
-
- de.hybris.platform.servicelayer.ServicelayerTest
-
- de.hybris.platform.servicelayer.ServicelayerTransactionalTest
-
- de.hybris.platform.category.impl.DefaultCategoryServiceDemoTest
-
- All Implemented Interfaces:
JaloSessionHolder
@DemoTest public class DefaultCategoryServiceDemoTest extends ServicelayerTransactionalTest
Tests for theDefaultCategoryService.
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.ServicelayerTest
importService
-
Fields inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
jaloSession
-
-
Constructor Summary
Constructors Constructor Description DefaultCategoryServiceDemoTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetUp()voidshouldGetCategoryPathForProduct()voidshouldGetCategoryPathForProductWithCategoryClassOnly()voidshouldReturnCategoryPathForProductWithRootAsFirstElementOfList()voidshouldSetAllowedPrincipalsForCategoryAndRecursivelyToAllSubcategoriesAndSupercategories()voidshouldSetAllowedPrincipalsOnlyForPassedCategory()voidtestGetCategories()Tests the categoryService.getCategories(catalogVersion, product) gets the categories that belong to hwcatalog.online and contain the product with code "HW2300-4121", gets the codes of the result, and checks whether they are expected.voidtestGetCategoryForCode()Checks that the category with code "testCategory0" exists.voidtestGetNonExistingCategory()Checks that the category with code "gibtesnicht" does NOT exist, and null is returnedvoidtestGetNonExistingCategoryForCode()Checks that the category with code "gibtesnicht" does NOT exist, and UnknownIdentifierException is thrown.voidtestGetPaths()Checks all paths of the specific category.voidtestIsEmpty()Tests whether the category is empty.voidtestIsRoot()Tests whether the category is a root category.voidtestRootCategories()Tests the categoryService.getRootCategories(catalogVersion).voidtestSetAllowedPrincipalsWitNotSavedModels()Tests to add principals for unsaved category without exception.-
Methods inherited from class de.hybris.platform.servicelayer.ServicelayerTest
createCoreData, createDefaultCatalog, createDefaultUsers, createHardwareCatalog, getApplicationContext, importCsv, importData, importData, importData, importStream, importStream, isPrefetchModeNone
-
Methods inherited from class de.hybris.platform.servicelayer.ServicelayerBaseTest
autowireProperties, getBeanName, prepareApplicationContextAndSession
-
Methods inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
establishJaloSession, finish, getOrCreateCurrency, getOrCreateLanguage, init, intenseChecksActivated, takeJaloSession
-
-
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldGetCategoryPathForProduct
public void shouldGetCategoryPathForProduct()
-
shouldGetCategoryPathForProductWithCategoryClassOnly
public void shouldGetCategoryPathForProductWithCategoryClassOnly()
-
testGetCategories
public void testGetCategories()
Tests the categoryService.getCategories(catalogVersion, product)- gets the categories that belong to hwcatalog.online and contain the product with code "HW2300-4121",
- gets the codes of the result, and checks whether they are expected.
-
testGetCategoryForCode
public void testGetCategoryForCode() throws java.lang.ExceptionChecks that the category with code "testCategory0" exists.- Throws:
java.lang.Exception
-
testGetNonExistingCategory
public void testGetNonExistingCategory() throws java.lang.ExceptionChecks that the category with code "gibtesnicht" does NOT exist, and null is returned- Throws:
java.lang.Exception
-
testGetNonExistingCategoryForCode
public void testGetNonExistingCategoryForCode() throws java.lang.ExceptionChecks that the category with code "gibtesnicht" does NOT exist, and UnknownIdentifierException is thrown.- Throws:
java.lang.Exception
-
testGetPaths
public void testGetPaths()
Checks all paths of the specific category.- tests the category "HW1240" has two paths, and the detail of them,
- tests the category "HW2320" has two paths, and the detail of them.
-
testIsEmpty
public void testIsEmpty()
Tests whether the category is empty.- checks the category "HW2320" is not empty,
- creates a new category "flexible_category", and checks that is empty,
- creates another category "empty_category" and assign the "flexible_category" as its super-category,
- checks that the "flexible_category" is not empty now,
- removes the "empty_category", and checks that the "flexible_category" is empty again,
- creates a product and assign it to the "flexible_category",
- checks that the "flexible_category" is not empty,
- removes the product, and checks that the category "flexible_category" is empty again.
-
testIsRoot
public void testIsRoot()
Tests whether the category is a root category.- checks the category "HW1000" is a root category,
- checks the category "HW1100" is not a root category.
-
testRootCategories
public void testRootCategories() throws java.lang.ExceptionTests the categoryService.getRootCategories(catalogVersion).- gets the root categories of testCatalog.Online, and tests that they don't have super categories,
- gets the root categories of a catalog version, and tests the result,
- gets the root categories of a classification system version, and tests the result.
- Throws:
java.lang.Exception
-
shouldSetAllowedPrincipalsForCategoryAndRecursivelyToAllSubcategoriesAndSupercategories
public void shouldSetAllowedPrincipalsForCategoryAndRecursivelyToAllSubcategoriesAndSupercategories()
-
shouldSetAllowedPrincipalsOnlyForPassedCategory
public void shouldSetAllowedPrincipalsOnlyForPassedCategory()
-
testSetAllowedPrincipalsWitNotSavedModels
public void testSetAllowedPrincipalsWitNotSavedModels()
Tests to add principals for unsaved category without exception.
-
shouldReturnCategoryPathForProductWithRootAsFirstElementOfList
public void shouldReturnCategoryPathForProductWithRootAsFirstElementOfList()
-
-