@Test public void testLogErrorMsgAndThrowableWaitDefault() throws Exception { final String expectedErrorMessage = "This is a test error message!"; final Exception expectedException = new Exception("test exception"); EasyMockSupport mockSupport = new EasyMockSupport(); Logger loggerMock = mockSupport.createMock(Logger.class); AtomicInteger testAtomicInteger = new AtomicInteger(0); Capture<Exception> exceptionCaptureOne = EasyMock.newCapture(); loggerMock.error(eq(expectedErrorMessage), capture(exceptionCaptureOne)); expectLastCall().times(1); mockSupport.replayAll(); for (int i = 0; i < 1000; i++) { Utils.logErrorMessageWithThrowableWithCounter(loggerMock, testAtomicInteger, expectedErrorMessage, expectedException); } assertSame("Exception passed to Logger should have been the same instance passed into the Utils method", expectedException, exceptionCaptureOne.getValue()); mockSupport.verifyAll(); }
static void logErrorMessageWithThrowableWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage, Throwable throwable) { logErrorMessageWithThrowableWithCounter(logger, atomicInteger, errorMessage, throwable, WAIT_COUNT_MAX); }
Utils { static void logErrorMessageWithThrowableWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage, Throwable throwable) { logErrorMessageWithThrowableWithCounter(logger, atomicInteger, errorMessage, throwable, WAIT_COUNT_MAX); } }
Utils { static void logErrorMessageWithThrowableWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage, Throwable throwable) { logErrorMessageWithThrowableWithCounter(logger, atomicInteger, errorMessage, throwable, WAIT_COUNT_MAX); } private  Utils(); }
Utils { static void logErrorMessageWithThrowableWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage, Throwable throwable) { logErrorMessageWithThrowableWithCounter(logger, atomicInteger, errorMessage, throwable, WAIT_COUNT_MAX); } private  Utils();  }
Utils { static void logErrorMessageWithThrowableWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage, Throwable throwable) { logErrorMessageWithThrowableWithCounter(logger, atomicInteger, errorMessage, throwable, WAIT_COUNT_MAX); } private  Utils();   }