* Test execute success.
*/
public void testExecuteSuccess() {
try {
DeployMojo deployMojo = new DeployMojo();
Command command = new Command(null);
command.setVerbose(true);
EasyMock.expect(log.isInfoEnabled()).andReturn(false).times(2);
EasyMock.expect(clownfishFactory.createClownfish(
command, clownfishHelper, progressListenerFactory,
maven2WrapperLog))
.andReturn(clownfish);
EasyMock.expect(clownfish.deploy()).andReturn(true);
clownfish.destroy();
EasyMock.replay(log);
EasyMock.replay(maven2WrapperLog);
EasyMock.replay(clownfish);
EasyMock.replay(clownfishFactory);
EasyMock.replay(clownfishHelper);
deployMojo.setClownfishFactory(clownfishFactory);
deployMojo.setClownfishHelper(clownfishHelper);
deployMojo.setProgressListenerFactory(progressListenerFactory);
deployMojo.setCommand(command);
deployMojo.setMaven2WrapperLog(maven2WrapperLog);
deployMojo.setLog(log);
deployMojo.execute();
EasyMock.verify(log);
EasyMock.verify(clownfish);
EasyMock.verify(clownfishFactory);
EasyMock.verify(clownfishHelper);
// test properties
assertFalse(deployMojo.isAutostart());
assertEquals(progressListenerFactory,
deployMojo.getProgressListenerFactory());
assertEquals(maven2WrapperLog,
deployMojo.getMaven2WrapperLog());
assertEquals(clownfish, deployMojo.getClownfish());
assertEquals(clownfishFactory, deployMojo.getClownfishFactory());
assertEquals(clownfishHelper, deployMojo.getClownfishHelper());
deployMojo.setAutostart(true);
deployMojo.setProgressListenerFactory(null);
deployMojo.setMaven2WrapperLog(null);
deployMojo.setClownfish(null);
deployMojo.setClownfishFactory(null);
deployMojo.setClownfishHelper(null);
assertTrue(deployMojo.isAutostart());
assertNull(deployMojo.getProgressListenerFactory());
assertNull(deployMojo.getMaven2WrapperLog());
assertNull(deployMojo.getClownfish());
assertNull(deployMojo.getClownfishFactory());
assertNull(deployMojo.getClownfishHelper());
} catch (MojoExecutionException e) {
fail(e.getMessage());
}
}