@Test
public void testLogErrorMsgWaitExceedsCustomMaxCount() throws Exception {

  final String expectedErrorMessage = "This is a test error message that should only repeat once!";
  EasyMockSupport mockSupport =
    new EasyMockSupport();
  Logger loggerMock =
    mockSupport.createMock(Logger.class);
  AtomicInteger testAtomicInteger = new AtomicInteger(0);
  // expect that the the call to the logger is only
  // executed twice in this test
  loggerMock.error(expectedErrorMessage);
  expectLastCall().times(2);
  mockSupport.replayAll();
  for (int i = 0; i < 10; i++) {
    Utils.logErrorMessageWithCounter(loggerMock, testAtomicInteger, expectedErrorMessage, 5);
  }
  mockSupport.verifyAll();
}