### Question:
SaveModel { void mkdir() { if (this.saveModel) { final File file = new File(this.outputModelDirectory); if (!file.exists()) { file.mkdirs(); } } } SaveModel();  SaveModel(final boolean saveModel, final String outputDir); boolean isConfigurationValid(); boolean isDirectoryValid(); void printConfiguration(); boolean isSaveModel(); void setSaveModel(final boolean saveModel); String getOutputModelDirectory(); void setOutputModelDirectory(final String outputModelDirectory); static final String DEFAULT_OUTPUT_DIR_NAME; }### Answer:
@Test public void mkdir_saveTrueNonExistingDirectory() throws IOException { File subDirectory = tempFolder.newFolder("folderPath", "subFolder"); subDirectory.delete(); SaveModel temp = new SaveModel(true, subDirectory.getAbsolutePath()); temp.mkdir(); assertTrue(subDirectory.isDirectory()); }
@Test public void mkdir_saveTrueExistingDirectory() throws IOException { File subDirectory = tempFolder.newFolder("folderPath", "subFolder"); subDirectory.mkdirs(); SaveModel temp = new SaveModel(true, subDirectory.getAbsolutePath()); temp.mkdir(); assertTrue(subDirectory.isDirectory()); }
@Test public void mkdir_saveFalse() throws IOException { File folder = tempFolder.newFile("validNonExistingFolder"); folder.delete(); SaveModel temp = new SaveModel(false, folder.getAbsolutePath()); temp.mkdir(); assertFalse(folder.exists()); }