public void testInputVariablesInteractive()
throws Exception
{
Mock mockPrompter = new Mock( Prompter.class );
mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).with( new IsAnything(),
new IsEqual( "artifactId-1.0" ) ).will(
new ReturnStub( "tag-value" ) );
phase.setPrompter( (Prompter) mockPrompter.proxy() );
List<MavenProject> reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) );
ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
releaseDescriptor.mapReleaseVersion( "groupId:artifactId", "1.0" );
releaseDescriptor.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" );
phase.execute( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );
assertEquals( "Check tag", "tag-value", releaseDescriptor.getScmReleaseLabel() );
releaseDescriptor = new ReleaseDescriptor();
releaseDescriptor.mapReleaseVersion( "groupId:artifactId", "1.0" );
releaseDescriptor.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" );
mockPrompter.reset();
mockPrompter.expects( new InvokeOnceMatcher() ).method( "prompt" ).with( new IsAnything(),
new IsEqual( "artifactId-1.0" ) ).will(
new ReturnStub( "simulated-tag-value" ) );
phase.simulate( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );