Class ClassPathLoader


  • public class ClassPathLoader
    extends java.lang.Object
    Loads configuration or extension points available in the classpath.

    • Can load the mockito configuration. The user who want to provide his own mockito configuration should write the class org.mockito.configuration.MockitoConfiguration that implements IMockitoConfiguration. For example :
      
       package org.mockito.configuration;
      
       //...
      
       public class MockitoConfiguration implements IMockitoConfiguration {
           boolean enableClassCache() { return false; }
      
           // ...
       }
           
    • Can load available mockito extensions. Currently Mockito only have one extension point the MockMaker. This extension point allows a user to provide his own bytecode engine to build mocks.
      Suppose you wrote an extension to create mocks with some Awesome library, in order to tell Mockito to use it you need to put in your classpath
      1. The implementation itself, for example org.awesome.mockito.AwesomeMockMaker.
      2. A file named org.mockito.plugins.MockMaker in a folder named mockito-extensions, the content of this file need to have one line with the qualified name org.awesome.mockito.AwesomeMockMaker.

    • Field Detail

      • MOCKITO_CONFIGURATION_CLASS_NAME

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

      • ClassPathLoader

        public ClassPathLoader()
    • Method Detail

      • loadConfiguration

        public IMockitoConfiguration loadConfiguration()
        Returns:
        configuration loaded from classpath or null