Class EnumerationServiceDemoTest
- java.lang.Object
-
- de.hybris.platform.testframework.HybrisJUnit4Test
-
- de.hybris.platform.servicelayer.ServicelayerBaseTest
-
- de.hybris.platform.servicelayer.ServicelayerTransactionalBaseTest
-
- de.hybris.platform.enumeration.EnumerationServiceDemoTest
-
- All Implemented Interfaces:
JaloSessionHolder
@IntegrationTest @DemoTest public class EnumerationServiceDemoTest extends ServicelayerTransactionalBaseTest
Tests demonstrating usage of the enumeration service.
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
jaloSession
-
-
Constructor Summary
Constructors Constructor Description EnumerationServiceDemoTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetUp()prepares some testdata, before execution of every test:
- the test EnumerationValueModel will be prepared (not persisted)voidtestChangingEnumerationName()Demonstrates how to use the enumerationService to get and set the Enumeration Name.voidtestGettingEnumerationValueByClassAndValue()Demonstrates how to use the enumerationService to get Enum-Values by class and value.voidtestGettingEnumerationValueByCodeAndValue()Demonstrates how to use the enumerationService to get Enum-Values by code and value.voidtestGettingEnumerationValuesByClass()Demonstrates how to use the enumerationService to get Enum-Values by class.voidtestGettingEnumerationValuesByCode()Demonstrates how to use the enumerationService to get Enum-Values by code.-
Methods inherited from class de.hybris.platform.servicelayer.ServicelayerBaseTest
autowireProperties, getApplicationContext, 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.Exceptionprepares some testdata, before execution of every test:
- the test EnumerationValueModel will be prepared (not persisted)- Throws:
java.lang.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.
-
-