Class 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!
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener

        org.junit.runner.notification.RunListener.ThreadSafe
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void entityCreated​(PK pk)  
      protected void prepareItem​(Item item)  
      protected void removeItems​(java.util.Collection<PK> pks)  
      void testFinished​(org.junit.runner.Description description)
      Removes all items registered at the item registry.
      void testStarted​(org.junit.runner.Description description)  
      protected boolean transactionsSupported()  
      • Methods inherited from class org.junit.runner.notification.RunListener

        testAssumptionFailure, testFailure, testIgnored, testRunFinished, testRunStarted
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ITEM_CREATION_LIFECYCLE_LISTENER

        public static final java.lang.String ITEM_CREATION_LIFECYCLE_LISTENER
        See Also:
        Constant Field Values
    • Constructor Detail

      • ItemCreationListener

        public ItemCreationListener()
    • Method Detail

      • testStarted

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

        public void testFinished​(org.junit.runner.Description description)
                          throws java.lang.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:
        java.lang.Exception
      • removeItems

        protected void removeItems​(java.util.Collection<PK> pks)
      • transactionsSupported

        protected boolean transactionsSupported()