Class DefaultCategoryServiceDemoTest

All Implemented Interfaces:
JaloSessionHolder

@DemoTest public class DefaultCategoryServiceDemoTest extends ServicelayerTransactionalTest
Tests for the DefaultCategoryService.
  • Constructor Details

    • DefaultCategoryServiceDemoTest

      public DefaultCategoryServiceDemoTest()
  • Method Details

    • setUp

      public void setUp() throws Exception
      Throws:
      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 Exception
      Checks that the category with code "testCategory0" exists.
      Throws:
      Exception
    • testGetNonExistingCategory

      public void testGetNonExistingCategory() throws Exception
      Checks that the category with code "gibtesnicht" does NOT exist, and null is returned
      Throws:
      Exception
    • testGetNonExistingCategoryForCode

      public void testGetNonExistingCategoryForCode() throws Exception
      Checks that the category with code "gibtesnicht" does NOT exist, and UnknownIdentifierException is thrown.
      Throws:
      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 Exception
      Tests 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:
      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()