Class PowerMockMaker

  • All Implemented Interfaces:
    org.mockito.plugins.MockMaker

    public class PowerMockMaker
    extends java.lang.Object
    implements org.mockito.plugins.MockMaker
    A PowerMock implementation of the MockMaker. Right now it simply delegates to the default Mockito MockMaker via Plugins.getMockMaker() but in the future we may use it more properly. The reason for its existence is that the current Mockito MockMaker throws exception when getting the name from of a mock that is created by PowerMock but not know for Mockito. This is triggered when by the MockUtil class. For more details see the ToStringGenerator.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  PowerMockMaker.PowerMockInternalMockHandler
      It needs to extend InternalMockHandler because Mockito requires the type to be of InternalMockHandler and not MockHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.mockito.plugins.MockMaker cglibMockMaker  
    • Constructor Summary

      Constructors 
      Constructor Description
      PowerMockMaker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T createMock​(org.mockito.mock.MockCreationSettings<T> settings, org.mockito.invocation.MockHandler handler)  
      org.mockito.invocation.MockHandler getHandler​(java.lang.Object mock)  
      void resetMock​(java.lang.Object mock, org.mockito.invocation.MockHandler newHandler, org.mockito.mock.MockCreationSettings settings)  
      • Methods inherited from class java.lang.Object

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

      • cglibMockMaker

        private final org.mockito.plugins.MockMaker cglibMockMaker
    • Constructor Detail

      • PowerMockMaker

        public PowerMockMaker()
    • Method Detail

      • createMock

        public <T> T createMock​(org.mockito.mock.MockCreationSettings<T> settings,
                                org.mockito.invocation.MockHandler handler)
        Specified by:
        createMock in interface org.mockito.plugins.MockMaker
      • getHandler

        public org.mockito.invocation.MockHandler getHandler​(java.lang.Object mock)
        Specified by:
        getHandler in interface org.mockito.plugins.MockMaker
      • resetMock

        public void resetMock​(java.lang.Object mock,
                              org.mockito.invocation.MockHandler newHandler,
                              org.mockito.mock.MockCreationSettings settings)
        Specified by:
        resetMock in interface org.mockito.plugins.MockMaker