fix SubstitutableLoggerTest

Signed-off-by: Ceki Gulcu <ceki@qos.ch>
This commit is contained in:
Ceki Gulcu 2022-01-05 22:09:05 +01:00
parent 0877cb6410
commit 23c8cc0121
2 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@ public class SubstituteLogger implements Logger {
@Override
public LoggingEventBuilder atLevel(Level level) {
return makeLoggingEventBuilder(level);
return delegate().atLevel(level);
}
@Override

View File

@ -63,14 +63,14 @@ public class SubstitutableLoggerTest {
assertTrue(substituteLogger.delegate() instanceof EventRecodingLogger);
Set<String> expectedMethodSignatures = determineMethodSignatures(Logger.class);
LoggerInvocationHandler ih = new LoggerInvocationHandler();
Logger proxyLogger = (Logger) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { Logger.class }, ih);
LoggerInvocationHandler loggerInvocationHandler = new LoggerInvocationHandler();
Logger proxyLogger = (Logger) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { Logger.class }, loggerInvocationHandler);
substituteLogger.setDelegate(proxyLogger);
invokeAllMethodsOf(substituteLogger);
// Assert that all methods are delegated
expectedMethodSignatures.removeAll(ih.getInvokedMethodSignatures());
expectedMethodSignatures.removeAll(loggerInvocationHandler.getInvokedMethodSignatures());
if (!expectedMethodSignatures.isEmpty()) {
fail("Following methods are not delegated " + expectedMethodSignatures.toString());
}