@Test
public void testExecute_valid_withSpecifiedInstance_deployed() throws Exception {

	this.cmd.applicationName = this.app.getName();
	this.cmd.scopedInstancePath = InstanceHelpers.computeInstancePath( this.app.getTomcatVm());
	this.app.getTomcatVm().setStatus( InstanceStatus.DEPLOYED_STARTED );
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	this.cmd.out = new PrintStream( os, true, "UTF-8" );
	this.cmd.execute();
	Mockito.verify( this.applicationMngr, Mockito.times( 1 )).findManagedApplicationByName( this.cmd.applicationName );
	Mockito.verify( this.debugMngr, Mockito.times( 1 )).pingMessageQueue( Mockito.anyString());
	Mockito.verify( this.debugMngr, Mockito.times( 1 )).pingAgent(
			Mockito.eq( this.ma ),
			Mockito.eq( this.app.getTomcatVm()),
			Mockito.anyString());
	String s = os.toString( "UTF-8" ).trim();
	Assert.assertTrue( s.startsWith( "Pinging the DM..." ));
	Assert.assertTrue( s.contains( "Pinging agent" ));
	Assert.assertFalse( s.contains( "null" ));
	Assert.assertTrue( s.contains( "[ FAILURE ]" ));
	Assert.assertFalse( s.contains( "[ SUCCESS ]" ));
}