Skip to content

Commit

Permalink
defaultAnswer(CALLS_REAL_METHODS) for defaultMock
Browse files Browse the repository at this point in the history
  • Loading branch information
markusschaefer authored and slawekjaranowski committed Nov 7, 2024
1 parent 5f92da7 commit fabb13a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;

import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.withSettings;

Expand All @@ -43,7 +44,7 @@ private static Logger createNewLoggerProxy(String name) {
return (Logger) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class<?>[]{Logger.class, ProxyMock.class},
new MockInvocationHandler(name, () ->
mock(SimpleLogger.class, withSettings().spiedInstance(new SimpleLogger(name)).stubOnly())
mock(SimpleLogger.class, withSettings().spiedInstance(new SimpleLogger(name)).defaultAnswer(CALLS_REAL_METHODS).stubOnly())
)
);
}
Expand Down

0 comments on commit fabb13a

Please sign in to comment.