Class ToStringGenerator


  • public class ToStringGenerator
    extends java.lang.Object
    We need to override the toString() in some classes because normally the toString "method" is assembled by calling the "qualifiedName" method but this is not possible in our case. The reason is that the qualifiedName method does
     new MockUtil().getMockName(mock)
     
    which later will call the "isMockitoMock" method which will return false and an exception will be thrown. The reason why "isMockitoMock" returns false is that the mock is not created by the Mockito CGLib Enhancer in case of static methods.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String generate​(java.lang.Object mock, java.lang.reflect.Method method, java.lang.Object[] arguments)  
      • Methods inherited from class java.lang.Object

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

      • ToStringGenerator

        public ToStringGenerator()
    • Method Detail

      • generate

        public java.lang.String generate​(java.lang.Object mock,
                                         java.lang.reflect.Method method,
                                         java.lang.Object[] arguments)