### Question:
ExternalLogger extends MarkerIgnoringBase { @Override public String getName() { return m_delegate.getName(); } ExternalLogger(Logger processLogger,
                        ThreadContextLocator threadContextLocator); @Override String getName(); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Object arg1, Object arg2); @Override void trace(String format, Object[] argArray); @Override void trace(String msg, Throwable t); @Override boolean isDebugEnabled(); @Override void debug(String msg); @Override void debug(String format, Object arg); @Override void debug(String format, Object arg1, Object arg2); @Override void debug(String format, Object[] argArray); @Override void debug(String msg, Throwable t); @Override boolean isInfoEnabled(); @Override void info(String msg); @Override void info(String format, Object arg); @Override void info(String format, Object arg1, Object arg2); @Override void info(String format, Object[] argArray); @Override void info(String msg, Throwable t); @Override boolean isWarnEnabled(); @Override void warn(String msg); @Override void warn(String format, Object arg); @Override void warn(String format, Object arg1, Object arg2); @Override void warn(String format, Object[] argArray); @Override void warn(String msg, Throwable t); @Override boolean isErrorEnabled(); @Override void error(String msg); @Override void error(String format, Object arg); @Override void error(String format, Object arg1, Object arg2); @Override void error(String format, Object[] argArray); @Override void error(String msg, Throwable t);  }### Answer:
@Test public void testGetName() { final Logger logger = new ExternalLogger(m_delegate, m_threadContextLocator); when(m_delegate.getName()).thenReturn("foo"); assertEquals("foo", logger.getName()); }
@Test public void testDelegateMethodsTakingNoMarker() throws Exception { when(m_threadContextLocator.get()).thenReturn(m_threadContext); when(m_threadContext.getLogMarker()).thenReturn(m_marker); final List<InvocationOnMock> invocations = new ArrayList<InvocationOnMock>(); final InvocationListener listeners = new InvocationListener() { public void reportInvocation(MethodInvocationReport report) { invocations.add((InvocationOnMock) report.getInvocation()); } }; final Logger delegate = mock(Logger.class, withSettings().invocationListeners(listeners)); final ExternalLogger logger = new ExternalLogger(delegate, m_threadContextLocator); final Method[] allMethods = Logger.class.getDeclaredMethods(); for (Method m : allMethods) { final Class<?>[] parameterTypes = m.getParameterTypes(); if (parameterTypes.length > 0 && parameterTypes[0].equals(Marker.class)) { continue; } final Class<?>[] delegateTypes = new Class<?>[parameterTypes.length + 1]; delegateTypes[0] = Marker.class; arraycopy(parameterTypes, 0, delegateTypes, 1, parameterTypes.length); final Method delegateMethod; try { delegateMethod = Logger.class.getMethod(m.getName(), delegateTypes); } catch (NoSuchMethodException e) { continue; } final RandomObjectFactory randomObjectFactory = new RandomObjectFactory(); final List<Object> parameters = new ArrayList<Object>(); for (Class<?> type : parameterTypes) { parameters.add(randomObjectFactory.generateParameter(type)); } m.invoke(logger, parameters.toArray()); final InvocationOnMock invocation = invocations.remove(0); assertEquals(delegateMethod, invocation.getMethod()); int i = 0; final Object[] invokedArguments = invocation.getArguments(); assertSame(m_marker, invokedArguments[0]); for (Object p : parameters) { assertSame(p, invokedArguments[++i]); } } assertEquals(0, invocations.size()); }