### Question:
AccuRevTagCommand extends AbstractAccuRevCommand { public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { return (TagScmResult) execute( repository, fileSet, parameters ); } AccuRevTagCommand( ScmLogger logger ); TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters );  }### Answer:
@Test public void testTag() throws Exception { final ScmFileSet testFileSet = new ScmFileSet( new File( "/my/workspace/project/dir" ) ); final File basedir = testFileSet.getBasedir(); final String basisStream = "basisStream"; final AccuRevInfo info = new AccuRevInfo( basedir ); info.setBasis( basisStream ); AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setStreamName( "myStream" ); repo.setAccuRev( accurev ); repo.setProjectPath( "/project/dir" ); when( accurev.info( basedir )).thenReturn(info); when( accurev.mksnap( "theTagName", basisStream ) ).thenReturn( Boolean.TRUE ); List<File> taggedFiles = Collections.singletonList( new File( "tagged/file" ) ); when( accurev.statTag( "theTagName" ) ).thenReturn( taggedFiles ); AccuRevTagCommand command = new AccuRevTagCommand( getLogger() ); CommandParameters commandParameters = new CommandParameters(); commandParameters.setString( CommandParameter.TAG_NAME, "theTagName" ); TagScmResult result = command.tag( repo, testFileSet, commandParameters ); assertThat( result.isSuccess(), is( true ) ); assertThat( result.getTaggedFiles().size(), is( 1 ) ); assertHasScmFile( result.getTaggedFiles(), "tagged/file", ScmFileStatus.TAGGED ); }
@Test public void testAccuRevError() throws Exception { final ScmFileSet testFileSet = new ScmFileSet( new File( "/my/workspace/project/dir" ) ); final File basedir = testFileSet.getBasedir(); final String basisStream = "basisStream"; final AccuRevInfo info = new AccuRevInfo( basedir ); info.setBasis( basisStream ); AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setStreamName( "myStream" ); repo.setAccuRev( accurev ); repo.setProjectPath( "/project/dir" ); when( accurev.info( basedir )).thenReturn(info); when( accurev.mksnap( "theTagName", basisStream ) ).thenReturn( Boolean.FALSE ); AccuRevTagCommand command = new AccuRevTagCommand( getLogger() ); CommandParameters commandParameters = new CommandParameters(); commandParameters.setString( CommandParameter.TAG_NAME, "theTagName" ); TagScmResult result = command.tag( repo, testFileSet, commandParameters ); assertThat( result.isSuccess(), is( false ) ); assertThat( result.getProviderMessage(), notNullValue() ); }