### Question:
AccuRevAddCommand extends AbstractAccuRevCommand { public AddScmResult add( ScmProviderRepository repo, ScmFileSet scmFileSet, CommandParameters commandParameters ) throws ScmException { return (AddScmResult) execute( repo, scmFileSet, commandParameters ); } AccuRevAddCommand( ScmLogger logger ); AddScmResult add( ScmProviderRepository repo, ScmFileSet scmFileSet, CommandParameters commandParameters );  }### Answer:
@Test public void testAdd() throws Exception { final ScmFileSet testFileSet = new ScmFileSet( basedir, new File( "src/main/java/Foo.java" ) ); final List<File> files = testFileSet.getFileList(); when( accurev.add( basedir, files, "A new file" ) ).thenReturn( Collections.singletonList( new File( "added/file" ) ) ); AccuRevAddCommand command = new AccuRevAddCommand( getLogger() ); CommandParameters commandParameters = new CommandParameters(); commandParameters.setString( CommandParameter.MESSAGE, "A new file" ); AddScmResult result = command.add( repo, testFileSet, commandParameters ); assertThat( result.isSuccess(), is( true ) ); assertThat( result.getAddedFiles().size(), is( 1 ) ); assertHasScmFile( result.getAddedFiles(), "added/file", ScmFileStatus.ADDED ); }
@Test public void testAddFailed() throws Exception { final ScmFileSet testFileSet = new ScmFileSet( basedir, new File( "src/main/java/Foo.java" ) ); final List<File> files = testFileSet.getFileList(); when( accurev.add( basedir, files, "A new file" ) ).thenReturn(null); AccuRevAddCommand command = new AccuRevAddCommand( getLogger() ); CommandParameters commandParameters = new CommandParameters(); commandParameters.setString( CommandParameter.MESSAGE, "A new file" ); AddScmResult result = command.add( repo, testFileSet, commandParameters ); assertThat( result.isSuccess(), is( false ) ); assertThat( result.getProviderMessage(), notNullValue() ); }