### Question:
SaveQueryResults { void mkdir() { if (this.saveResults) { final File file = new File(this.outputQueryResultDirectory); if (!file.exists()) { file.mkdirs(); } } } SaveQueryResults();  SaveQueryResults(final boolean saveResults, final String outputDir); boolean isConfigurationValid(); boolean isDirectoryValid(); boolean isSaveResults(); void setSaveResults(final boolean saveResults); String getOutputQueryResultDirectory(); void setOutputQueryResultDirectory(final String outputQueryResultDirectory); static final String DEFAULT_OUTPUT_DIR_NAME; }### Answer:
@Test public void mkdir_saveTrueNonExistingDirectory() throws IOException { File subDirectory = tempFolder.newFolder("folderPath", "subFolder"); subDirectory.delete(); SaveQueryResults temp = new SaveQueryResults(true, subDirectory.getAbsolutePath()); temp.mkdir(); assertTrue(subDirectory.isDirectory()); }
@Test public void mkdir_saveTrueExistingDirectory() throws IOException { File subDirectory = tempFolder.newFolder("folderPath", "subFolder"); subDirectory.mkdirs(); SaveQueryResults temp = new SaveQueryResults(true, subDirectory.getAbsolutePath()); temp.mkdir(); assertTrue(subDirectory.isDirectory()); }
@Test public void mkdir_saveFalse() throws IOException { File folder = tempFolder.newFile("validNonExistingFolder"); folder.delete(); SaveQueryResults temp = new SaveQueryResults(false, folder.getAbsolutePath()); temp.mkdir(); assertFalse(folder.exists()); }