@Test
public void testClose() throws InterruptedException {

    Map<String, Object> configs = initializeConfigWithReporter();
    graphiteReporter.configure(configs);
    ScheduledExecutorService mockExecutor = mock(ScheduledExecutorService.class);
    Future mockFuture = mock(Future.class);
    when(mockExecutor.submit(graphiteReporter)).thenReturn(mockFuture);
    when(mockExecutor.awaitTermination(20, TimeUnit.SECONDS)).thenReturn(true);
    Whitebox.setInternalState(graphiteReporter, "executor", mockExecutor);
    graphiteReporter.close();
    verify(mockExecutor).shutdown();
    verify(mockExecutor).submit(graphiteReporter);
    verify(mockExecutor).awaitTermination(20, TimeUnit.SECONDS);
}