### Question:
HgUtils { static Commandline buildCmd( File workingDir, String[] cmdAndArgs ) throws ScmException { Commandline cmd = new Commandline(); cmd.setExecutable( HgCommandConstants.EXEC ); cmd.addArguments( cmdAndArgs ); if ( workingDir != null ) { cmd.setWorkingDirectory( workingDir.getAbsolutePath() ); if ( !workingDir.exists() ) { boolean success = workingDir.mkdirs(); if ( !success ) { String msg = "Working directory did not exist" + " and it couldn't be created: " + workingDir; throw new ScmException( msg ); } } } return cmd; } private  HgUtils(); static ScmResult execute( HgConsumer consumer, ScmLogger logger, File workingDir, String[] cmdAndArgs ); static ScmResult execute( File workingDir, String[] cmdAndArgs ); static String[] expandCommandLine( String[] cmdAndArgs, ScmFileSet additionalFiles ); static int getCurrentRevisionNumber( ScmLogger logger, File workingDir ); static String getCurrentBranchName( ScmLogger logger, File workingDir ); static boolean differentOutgoingBranchFound( ScmLogger logger, File workingDir, String workingbranchName ); static String maskPassword( Commandline cl ); static final String DEFAULT; }### Answer:
@Test public void testNullWorkingDirectory() throws Exception { Commandline cmd = HgUtils.buildCmd( null, new String[] {} ); assertEquals( null, cmd.getWorkingDirectory() ); }