CheckerForHeartbeatsTask extends TimerTask { @Override public void run() { this.logger.finest( "The task that checks heart beats runs." ); for( ManagedApplication ma : this.appManager.getManagedApplications()) { ma.checkStates( this.notificationMngr ); } } CheckerForHeartbeatsTask( IApplicationMngr appManager, INotificationMngr notificationMngr ); @Override void run();  }
@Test public void testRun_noApplication() { INotificationMngr notificationMngr = Mockito.mock( INotificationMngr.class ); CheckerForHeartbeatsTask task = new CheckerForHeartbeatsTask( this.appManager, notificationMngr ); task.run(); Mockito.verifyZeroInteractions( notificationMngr ); }
@Test public void testRun() { INotificationMngr notificationMngr = Mockito.mock( INotificationMngr.class ); Application app = new Application( "test", new TestApplicationTemplate()); ManagedApplication ma = new ManagedApplication( app ); this.nameToManagedApplication.put( app.getName(), ma ); CheckerForHeartbeatsTask task = new CheckerForHeartbeatsTask( this.appManager, notificationMngr ); task.run(); Mockito.verifyZeroInteractions( notificationMngr ); }