Class EnumerationServiceDemoTest

All Implemented Interfaces:
JaloSessionHolder

@IntegrationTest @DemoTest public class EnumerationServiceDemoTest extends ServicelayerTransactionalBaseTest
Tests demonstrating usage of the enumeration service.
  • Constructor Details

    • EnumerationServiceDemoTest

      public EnumerationServiceDemoTest()
  • Method Details

    • setUp

      public void setUp() throws Exception
      prepares some testdata, before execution of every test:
      - the test EnumerationValueModel will be prepared (not persisted)
      Throws:
      Exception
    • testGettingEnumerationValuesByCode

      public void testGettingEnumerationValuesByCode()
      Demonstrates how to use the enumerationService to get Enum-Values by code. It shows also how to add a new Enum-Value.

      Test scenario:
      - Save the new EnumValue (model prepared in setup) and check if correctly saved.
      - Get the Enumeration Values for given code of type (e.g. OrderStatus).
      - Check the result list - the type of every item should match the given one.
      - Check the result - the list should contain the item with the code prepared in setUp

    • testGettingEnumerationValuesByClass

      public void testGettingEnumerationValuesByClass()
      Demonstrates how to use the enumerationService to get Enum-Values by class. It shows also how to add a new Enum-Value.

      Test scenario:
      - Save the new EnumValue (model prepared in setup) and check if correctly saved.
      - Get the Enumeration Values for given enum class (e.g. OrderStatus).
      - Check the result list - the type of every item should match the given one.
      - Check the result - the list should contain the item with the code prepared in setUp

    • testGettingEnumerationValueByCodeAndValue

      public void testGettingEnumerationValueByCodeAndValue()
      Demonstrates how to use the enumerationService to get Enum-Values by code and value. It shows also how to add a new Enum-Value.

      Test scenario:
      - get the Enumeration Values for given code of type and value (e.g. OrderStatus, code from prepared model).
      - check the result - unknown identifier Exception should be catched.
      - Save the new EnumValue (model prepared in setup) and repeat the previous steps again.
      - Check the result - this time the result should be the item with the code prepared in setUP

    • testGettingEnumerationValueByClassAndValue

      public void testGettingEnumerationValueByClassAndValue()
      Demonstrates how to use the enumerationService to get Enum-Values by class and value. It shows also how to add a new Enum-Value.

      Test scenario:
      - get the Enumeration Values for given class and value (e.g. OrderStatus, code from prepared model).
      - check the result - unknown identifier Exception should be catched.
      - Save the new EnumValue (model prepared in setup) and repeat the previous steps again.
      - Check the result - this time the result should be the item with the code prepared in setUP

    • testChangingEnumerationName

      public void testChangingEnumerationName()
      Demonstrates how to use the enumerationService to get and set the Enumeration Name. It shows also how to add a new Enum-Value.

      Test scenario:
      - Save the new EnumValue (model prepared in setup) and repeat the previous steps again.
      - fetch the saved enumValue using enumerationService method.
      - set enumerationName for the enum value.
      - get the enumerationName and check if correclty set.
      - repeat 2 previous steps with changed enumeration name.
      - try it again with locale parameter.