Class ItemCreationListener

java.lang.Object
org.junit.runner.notification.RunListener
de.hybris.platform.testframework.runlistener.ItemCreationListener
All Implemented Interfaces:
PersistencePool.PersistenceListener

public class ItemCreationListener extends org.junit.runner.notification.RunListener implements PersistencePool.PersistenceListener
RunListener assuring each created Item will be removed after finish of test. Similar to TransactionRunListener, but does not depend on used database. Will be disabled automatically for junit thread if transactional support is enabled by using annotation Transactional. Items created inside other threads are still logged and removed at the end of test!
  • Field Details

  • Constructor Details

    • ItemCreationListener

      public ItemCreationListener()
  • Method Details

    • testStarted

      public void testStarted(org.junit.runner.Description description) throws Exception
      Overrides:
      testStarted in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • testFinished

      public void testFinished(org.junit.runner.Description description) throws Exception
      Removes all items registered at the item registry. Will be called automatically at end of each test.
      Overrides:
      testFinished in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • removeItems

      protected void removeItems(Collection<PK> pks)
    • prepareItem

      protected void prepareItem(Item item) throws ConsistencyCheckException
      Throws:
      ConsistencyCheckException
    • entityCreated

      public void entityCreated(PK pk)
      Specified by:
      entityCreated in interface PersistencePool.PersistenceListener
    • transactionsSupported

      protected boolean transactionsSupported()