Class InterceptorRegistryTest

java.lang.Object
de.hybris.platform.servicelayer.interceptor.InterceptorRegistryTest

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Using own DefaultInterceptorRegistry.
    void
    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
    typecode test.
    void
    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
    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 Details

    • InterceptorRegistryTest

      public InterceptorRegistryTest()
  • Method Details

    • 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