Idea for spying final classes

21 views
Skip to first unread message

rogerdpack

unread,
Jan 10, 2022, 12:45:07 PM1/10/22
to mockito
I notice that with Mockito, assuming a logger instance is "final", you can't do 
logger = spy(logger); 
but you can do 
logger = mock(Logger.class);

So I had this idea...if the target of a spy is final, but not the class itself, maybe Mockito could create a "delegate" full object, to kind of wrap the final instance?  Just an idea.
Cheers!
Reply all
Reply to author
Forward
0 new messages