@Test
 public void testShutdownHook() {
   ArgumentCaptor<Thread> shutdownHookCaptor = ArgumentCaptor.forClass(Thread.class);
   DataCollectorMain main = new TMain();
   Assert.assertEquals(0, main.doMain());
   Mockito.verify(runtime, Mockito.times(1)).addShutdownHook(shutdownHookCaptor.capture());
   Mockito.reset(task);
   shutdownHookCaptor.getValue().run();
   Mockito.verify(task, Mockito.times(1)).stop();
 }
 @Test
 public void testRunException() {
   Mockito.doThrow(new RuntimeException()).when(task).run();
   DataCollectorMain main = new TMain();
   Assert.assertEquals(1, main.doMain());
   Mockito.verify(logConfigurator, Mockito.times(1)).configure();
   Mockito.verify(buildInfo, Mockito.times(1)).log(Mockito.any(Logger.class));
   Mockito.verify(runtimeInfo, Mockito.times(1)).log(Mockito.any(Logger.class));
   Mockito.verify(task, Mockito.times(1)).init();
   Mockito.verify(runtime, Mockito.times(1)).addShutdownHook(Mockito.any(Thread.class));
   Mockito.verify(task, Mockito.times(1)).run();
   Mockito.verify(runtime, Mockito.times(0)).removeShutdownHook(Mockito.any(Thread.class));
 }
 @Test
 public void testOKFullRun() {
   DataCollectorMain main = new TMain();
   Mockito.verifyZeroInteractions(runtime);
   Mockito.verifyZeroInteractions(logConfigurator);
   Mockito.verifyZeroInteractions(buildInfo);
   Mockito.verifyZeroInteractions(runtimeInfo);
   Mockito.verifyZeroInteractions(task);
   Assert.assertEquals(0, main.doMain());
   Mockito.verify(logConfigurator, Mockito.times(1)).configure();
   Mockito.verify(buildInfo, Mockito.times(1)).log(Mockito.any(Logger.class));
   Mockito.verify(runtimeInfo, Mockito.times(1)).log(Mockito.any(Logger.class));
   Mockito.verify(task, Mockito.times(1)).init();
   Mockito.verify(runtime, Mockito.times(1)).addShutdownHook(Mockito.any(Thread.class));
   Mockito.verify(task, Mockito.times(1)).run();
   Mockito.verify(runtime, Mockito.times(1)).removeShutdownHook(Mockito.any(Thread.class));
 }
 @Test
 public void testMainClassGetRuntime() {
   DataCollectorMain main = new DataCollectorMain();
   Assert.assertEquals(Runtime.getRuntime(), main.getRuntime());
 }