/**
* Test execute fail.
*/
public void testExecuteFail() {
StopMojo stopMojo = new StopMojo();
Command command = new Command(null);
command.setVerbose(true);
Exception exception = new RuntimeException("test mock exception");
EasyMock.expect(log.isInfoEnabled()).andReturn(false).once();
EasyMock.expect(clownfishFactory.createClownfish(
command, clownfishHelper, progressListenerFactory,
maven2WrapperLog))
.andReturn(clownfish);
EasyMock.expect(clownfish.stop()).andThrow(exception);
log.error("Exception thrown while stopping", exception);
clownfish.destroy();
EasyMock.replay(log);
EasyMock.replay(clownfish);
EasyMock.replay(clownfishFactory);
EasyMock.replay(clownfishHelper);
stopMojo.setClownfishFactory(clownfishFactory);
stopMojo.setClownfishHelper(clownfishHelper);
stopMojo.setProgressListenerFactory(progressListenerFactory);
stopMojo.setCommand(command);
stopMojo.setMaven2WrapperLog(maven2WrapperLog);
stopMojo.setLog(log);
try {
stopMojo.execute();
fail("execute should fail "
+ "- should throw MojoExecutionException");
} catch (MojoExecutionException e) {
// do-nothing
}