RunPerformGoalsPhase phase = (RunPerformGoalsPhase) lookup( ReleasePhase.ROLE, "run-perform-goals" );
phase.setMavenExecutor( mock );
ScmProvider scmProviderMock = mock( ScmProvider.class );
when( scmProviderMock.checkOut( isA( ScmRepository.class ),
argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
stub.setScmProvider( scmProviderMock );
ReleaseDescriptorStoreStub configStore = new ReleaseDescriptorStoreStub();
configStore.getReleaseConfiguration().setCompletedPhase( "end-release" );
releaseManager.setConfigStore( configStore );
// execute
releaseManager.perform( releaseDescriptor, new DefaultReleaseEnvironment(), createReactorProjects() );
// verify
verify( mock ).executeGoals( eq( checkoutDirectory ),
eq( "goal1 goal2" ),
isA( ReleaseEnvironment.class ),
eq( true ),
eq( "-DperformRelease=true -f pom.xml" ),
isNull( String.class ),
isA( ReleaseResult.class ) );
verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
isA( ScmTag.class ) );
verifyNoMoreInteractions( mock, scmProviderMock );
}