org.powermock.api.mockito.internal.invocation
Class ToStringGenerator

java.lang.Object
  extended by org.powermock.api.mockito.internal.invocation.ToStringGenerator

public class ToStringGenerator
extends 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.


Constructor Summary
ToStringGenerator()
           
 
Method Summary
 String generate(Object mock, Method method, 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 String generate(Object mock,
                       Method method,
                       Object[] arguments)


Copyright © 2007-2014. All Rights Reserved.