Class NoOpMockitoPostProcessor

java.lang.Object
org.springframework.boot.test.mock.mockito.MockitoPostProcessor
org.broadleafcommerce.test.config.NoOpMockitoPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor, org.springframework.core.Ordered

public class NoOpMockitoPostProcessor extends org.springframework.boot.test.mock.mockito.MockitoPostProcessor
So, this is a long story and exists as a workaround for a known Broadleaf problem with LTW. This BeanFactoryPostProcessor actually scans every bean definition early to look for appropriate configuration classes for mocks. It is automatically registered as part of "spring-boot-starter-test" artifact inclusion. This ends up loading (but not initializing) any entity class along the way (e.g. a entity class may be mentioned in a @Service class's import block). As a result, our LTW process complains about un-transformed entities. This hack is to disable this post processor, since we don't need @Mock support for this MVC integration test. A longer term fix is to find a earlier integration point for registering class transformers with the ClassLoader during the Spring startup lifecycle.
Author:
Jeff Fischer
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
     

    Methods inherited from class org.springframework.boot.test.mock.mockito.MockitoPostProcessor

    createSpyIfNecessary, getOrder, postProcessProperties, register, register, register, setBeanClassLoader, setBeanFactory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor

    postProcessAfterInitialization, postProcessBeforeInitialization

    Methods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor

    postProcessAfterInstantiation, postProcessBeforeInstantiation
  • Constructor Details

    • NoOpMockitoPostProcessor

      public NoOpMockitoPostProcessor()
  • Method Details

    • postProcessBeanFactory

      public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
      Overrides:
      postProcessBeanFactory in class org.springframework.boot.test.mock.mockito.MockitoPostProcessor
      Throws:
      org.springframework.beans.BeansException