### Question:
WorkspaceBuilder { public void build(){ createWorkspaceDirectory(); createLogRoot(); createCertsRoot(); createDownloadDirectory(); try { copyNeededFiles(); } catch (Exception e) { throw new RuntimeException(e); } } WorkspaceBuilder(String target); void build(); static void createFolder(final String  file); void copyNeededFiles(); static void copyFile(File origFile, File destDir, String fileName);  }### Answer:
@Test public void testBuild() throws Exception { String workingDirectory = Files.createTempDir().getAbsolutePath(); WorkspaceBuilder workspaceBuilder = new WorkspaceBuilder(workingDirectory); workspaceBuilder.build(); assertTrue(new File(workingDirectory).exists()); assertTrue(new File(workingDirectory, "logs").exists()); assertTrue(new File(workingDirectory, "browser/ff/profiles/sahi0").exists()); assertTrue(new File(workingDirectory, "browser/ff/profiles/sahi0/prefs.js").exists()); assertTrue(new File(workingDirectory, "config/download_contenttypes.txt").exists()); assertTrue(new File(workingDirectory, "config/download_urls.txt").exists()); assertTrue(new File(workingDirectory, "config/exclude_inject.txt").exists()); assertTrue(new File(workingDirectory, "config/jira.properties").exists()); assertTrue(new File(workingDirectory, "config/log.properties").exists()); assertTrue(new File(workingDirectory, "config/userdata.properties").exists()); assertTrue(new File(workingDirectory, "config/browser_types.xml").exists()); assertTrue(new File(workingDirectory, "phantomscript/phantom.js").exists()); assertTrue(new File(workingDirectory, "config/domainfix.txt").exists()); }
@Test public void doNotOverwriteBrowserTypes() throws URISyntaxException, IOException { String workingDirectory = Files.createTempDir().getAbsolutePath(); WorkspaceBuilder wb = new WorkspaceBuilder(workingDirectory); wb.build(); File browserTypes = new File(new File(workingDirectory, WorkspaceBuilder.USER_CONFIG_ROOT), WorkspaceBuilder.BROWSER_TYPES); long sizeOfFile= browserTypes.length(); browserTypes.delete(); browserTypes.createNewFile(); long sizeOfEmptyFile= browserTypes.length(); wb.build(); assertEquals(sizeOfEmptyFile, browserTypes.length()); }