public void testExecutionWithCommandLineException()
throws MavenExecutorException
{
File workingDirectory = getTestFile( "target/working-directory" );
Mock commandLineMock = new Mock( Commandline.class );
commandLineMock.expects( new InvokeOnceMatcher() ).method( "setWorkingDirectory" ).with(
new IsEqual( workingDirectory.getAbsolutePath() ) );
commandLineMock.expects( new InvokeOnceMatcher() ).method( "addEnvironment" ).with(
new IsEqual( "MAVEN_TERMINATE_CMD" ), new IsEqual( "on" ) );
commandLineMock.expects( new InvokeOnceMatcher() ).method( "execute" ).will(
new ThrowStub( new CommandLineException( "..." ) ) );
expectDefaultArguments( commandLineMock );
Mock mock = new Mock( CommandLineFactory.class );
mock.expects( new InvokeOnceMatcher() ).method( "createCommandLine" ).with( new IsEqual( "mvn" ) ).will(
new ReturnStub( commandLineMock.proxy() ) );
executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );
try
{
executor.executeGoals( workingDirectory, "clean integration-test", false, null, new ReleaseResult() );