Source:
<code><START> public void testStateAdvancedChange_stopFails() throws InterruptedException { <END> this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void stop( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testStateAdvancedChange_stopFails() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void stop( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }