Class InterceptorRegistryTest


  • @UnitTest
    public class InterceptorRegistryTest
    extends java.lang.Object
    Testing the order of the registered Interceptors and the dependency of their typecode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setUp()
      Using own DefaultInterceptorRegistry.
      void testOrderedUnitPrepareInterceptors()
      GIVEN:
      added in the following order: AAA PrepareInterceptor, order=10, type=unit BBB PrepareInterceptor, default order, type=unit CCC PrepareInterceptor, order=1, type=unit THEN:
      lowest order number first registry.getPrepareInterceptors() returns in this order: CCC, AAA, BBB
      void testRegister()
      typecode test.
      void testRegisterOrdered()
      GIVEN:
      added in the following order: 1: TestLoadInterceptor, order=50, type=product 2: TestLoadInterceptor, order=500, type=item 3: TestLoadInterceptor, order=5, type=product 4: TestLoadInterceptor, defaultorder, type=unit 5: TestLoadInterceptor, order=5, type=unit 6: TestLoadInterceptor, defaultorder, type=item 7: TestLoadInterceptor, order=4, type=unit, replacing 6 8: TestLoadInterceptor, order=30, type=item THEN:
      lowest order number first
      registry.getLoadInterceptors("Product") returns: 3, 8, 1, 2, 6
      registry.getLoadInterceptors("Unit") returns: 7, 5, 8, 2, 4
      void testRegisterWithReplacement()
      GIVEN:
      added in the following order: TestLoadInterceptor, default order, type=item TestLoadInterceptor, default order, type=product, replacing the item TestLoadInterceptor THEN:
      lowest order number first registry.getLoadInterceptors("Item") returns only one TestLoadInterceptor - for item registry.getLoadInterceptors("Product") returns only one TestLoadInterceptor - for product only, the item loadinterceptor was replaced registry.getPrepareInterceptors("Product") returns nothing, no prepare was registered here
      • Methods inherited from class java.lang.Object

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

      • InterceptorRegistryTest

        public InterceptorRegistryTest()
    • Method Detail

      • setUp

        public void setUp()
        Using own DefaultInterceptorRegistry. Only allowed types: item, extensibleitem, product, unit
      • testRegister

        public void testRegister()
        typecode test. Register one TestLoadInterceptor for ExtensibleItem and one for Unit.
      • testRegisterOrdered

        public void testRegisterOrdered()
        GIVEN:
        added in the following order:
        • 1: TestLoadInterceptor, order=50, type=product
        • 2: TestLoadInterceptor, order=500, type=item
        • 3: TestLoadInterceptor, order=5, type=product
        • 4: TestLoadInterceptor, defaultorder, type=unit
        • 5: TestLoadInterceptor, order=5, type=unit
        • 6: TestLoadInterceptor, defaultorder, type=item
        • 7: TestLoadInterceptor, order=4, type=unit, replacing 6
        • 8: TestLoadInterceptor, order=30, type=item
        THEN:
        lowest order number first
        registry.getLoadInterceptors("Product") returns: 3, 8, 1, 2, 6
        registry.getLoadInterceptors("Unit") returns: 7, 5, 8, 2, 4
      • testRegisterWithReplacement

        public void testRegisterWithReplacement()
        GIVEN:
        added in the following order:
        • TestLoadInterceptor, default order, type=item
        • TestLoadInterceptor, default order, type=product, replacing the item TestLoadInterceptor
        THEN:
        lowest order number first
        • registry.getLoadInterceptors("Item") returns only one TestLoadInterceptor - for item
        • registry.getLoadInterceptors("Product") returns only one TestLoadInterceptor - for product only, the item loadinterceptor was replaced
        • registry.getPrepareInterceptors("Product") returns nothing, no prepare was registered here
      • testOrderedUnitPrepareInterceptors

        public void testOrderedUnitPrepareInterceptors()
        GIVEN:
        added in the following order:
        • AAA PrepareInterceptor, order=10, type=unit
        • BBB PrepareInterceptor, default order, type=unit
        • CCC PrepareInterceptor, order=1, type=unit
        THEN:
        lowest order number first registry.getPrepareInterceptors() returns in this order: CCC, AAA, BBB