public void createWorkingDirectoryIfNotExists() throws IOException { try { createDirIfNotExists(runStepConfig.getWorkingDirectory()); } catch (IOException e) { throw new IOException("Could not create or open working directory.", e); } }
private void createOrClearDirectoryBelowWorkingDir(String workingDirectory, String subDirectory) throws IOException { try { final String subDirectoryPath = workingDirectory + "/" + subDirectory; createDirIfNotExists(subDirectoryPath); clearDirectory(subDirectoryPath); } catch (IOException e) { throw new IOException("Could not create or open " + subDirectory + " directory.", e); } }
@Test public void shouldCreateDirectory() throws IOException { //when testee.createDirIfNotExists(tempDirPath + "/testdirforlineuptest"); //then assertThat(Files.isDirectory(Paths.get(tempDirPath + "/testdirforlineuptest")), is(true)); }
@Before public void setup() throws IOException { initMocks(this); tempDirPath = tempDir.getRoot().getPath(); writeScreenshotTestPath = tempDirPath + "/testdirforlineupwritetest"; runStepConfig = jLineupRunConfigurationBuilder() .withWorkingDirectory(writeScreenshotTestPath) .withScreenshotsDirectory("screenshots") .withReportDirectory("report") .build(); testee = new FileService(runStepConfig); testee.createDirIfNotExists(writeScreenshotTestPath); testee.createDirIfNotExists(writeScreenshotTestPath + "/screenshots"); testee.createDirIfNotExists(writeScreenshotTestPath + "/report"); }