@Test
public void testCheckStates() {

	INotificationMngr notificationMngr = Mockito.mock( INotificationMngr.class );
	Assert.assertNull( this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	this.app.getMySqlVm().setStatus( InstanceStatus.DEPLOYED_STARTED );
	this.ma.checkStates( notificationMngr );
	Assert.assertEquals( "1", this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	Mockito.verifyZeroInteractions( notificationMngr );
	this.ma.acknowledgeHeartBeat( this.app.getMySqlVm());
	Assert.assertNull( this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, this.app.getMySqlVm().getStatus());
	for( int i=0; i<=ManagedApplication.THRESHOLD; i++ ) {
		this.ma.checkStates( notificationMngr );
		Assert.assertEquals(
				String.valueOf( i ),
				String.valueOf( i+1 ),
				this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	}
	Assert.assertEquals( InstanceStatus.PROBLEM, this.app.getMySqlVm().getStatus());
	Mockito.verify( notificationMngr ).instance( this.app.getMySqlVm(), this.app, EventType.CHANGED );
	Mockito.reset( notificationMngr );
	this.app.getMySqlVm().setStatus( InstanceStatus.UNDEPLOYING );
	this.ma.checkStates( notificationMngr );
	Assert.assertNull( this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	Mockito.verifyZeroInteractions( notificationMngr );
	this.app.getMySqlVm().setStatus( InstanceStatus.DEPLOYING );
	this.ma.checkStates( notificationMngr );
	Assert.assertNull( this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	Mockito.verifyZeroInteractions( notificationMngr );
	this.app.getMySqlVm().setStatus( InstanceStatus.NOT_DEPLOYED );
	this.ma.checkStates( notificationMngr );
	Assert.assertNull( this.app.getMySqlVm().data.get( ManagedApplication.MISSED_HEARTBEATS ));
	Mockito.verifyZeroInteractions( notificationMngr );
}