### Question:
AccuRevCommandLine implements AccuRev { public List<File> popExternal( File basedir, String versionSpec, String tranSpec, Collection<File> elements ) throws AccuRevException { if ( elements == null || elements.isEmpty() ) { elements = Collections.singletonList( new File( "/./" ) ); } if ( StringUtils.isBlank( tranSpec ) ) { tranSpec = "now"; } String[] popArgs; if ( AccuRevVersion.isNow( tranSpec ) ) { popArgs = new String[] { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-R" }; } else { popArgs = new String[] { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-t", tranSpec, "-R" }; } List<File> poppedFiles = new ArrayList<File>(); boolean ret = executeCommandLine( basedir, popArgs, elements, FileConsumer.POPULATE_PATTERN, poppedFiles ); return ret ? poppedFiles : null; } AccuRevCommandLine();  AccuRevCommandLine( String host, int port ); void setServer( String host, int port ); void setExecutable( String accuRevExe ); void reset(); boolean mkws( String basisStream, String workspaceName, File basedir ); List<File> update( File baseDir, String transactionId ); List<File> add( File basedir, List<File> elements, String message ); List<File> defunct( File basedir, List<File> files, String message ); List<File> promote( File basedir, List<File> files, String message ); String getCommandLines(); String getErrorOutput(); void setLogger( ScmLogger logger ); ScmLogger getLogger(); boolean mkdepot( String depotName ); boolean mkstream( String backingStream, String newStreamName ); boolean promoteStream( String subStream, String commitMessage, List<File> promotedFiles ); List<File> promoteAll( File baseDir, String commitMessage ); AccuRevInfo info( File basedir ); boolean reactivate( String workSpaceName ); boolean rmws( String workSpaceName ); String stat( File element ); boolean chws( File basedir, String workSpaceName, String newBasisStream ); boolean mksnap( String snapShotName, String basisStream ); List<File> statTag( String streamName ); List<File> stat( File basedir, Collection<File> elements, AccuRevStat statType ); List<File> pop( File basedir, Collection<File> elements ); List<File> popExternal( File basedir, String versionSpec, String tranSpec, Collection<File> elements ); CategorisedElements statBackingStream( File basedir, Collection<File> elements ); List<Transaction> history( String baseStream, String fromTimeSpec, String toTimeSpec, int count,
                                      boolean depotHistory, boolean transactionsOnly ); List<FileDifference> diff( String baseStream, String fromTimeSpec, String toTimeSpec ); boolean login( String user, String password ); boolean logout(); List<BlameLine> annotate( File basedir, File file ); Map<String, WorkSpace> showRefTrees(); Map<String, WorkSpace> showWorkSpaces(); Stream showStream( String stream ); String getExecutable(); String getClientVersion(); boolean syncReplica();  }### Answer:
@Test public void testPopExternal() throws Exception { AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester( "aHost", 5051 ); accuRevCL.setExecutable( "accurev.exe" ); File testfile = new File( "/my/export" ); File projectDir = new File( "/./project/dir" ); accuRevCL.popExternal( testfile, "stream", "12", Collections.singleton( projectDir ) ); Commandline lastCL = accuRevCL.getCommandline(); assertThat( lastCL.getLiteralExecutable(), is( "accurev.exe" ) ); assertThat( lastCL.getArguments(), is( new String[] { "pop", "-H", "aHost:5051", "-v", "stream", "-L", testfile.getAbsolutePath(), "-t", "12", "-R", projectDir.getPath() } ) ); }