### Question:
SaveModel { public boolean isDirectoryValid() { final File file = new File(this.outputModelDirectory); return !file.exists() || file.isDirectory(); } 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 isDirectoryValid_nonExistingDirectory_valid() throws IOException { File nonExistingDirectory = tempFolder.newFolder("folderPath"); nonExistingDirectory.delete(); SaveModel temp = new SaveModel(true, nonExistingDirectory.getAbsolutePath()); assertTrue(temp.isDirectoryValid()); }
@Test public void isDirectoryValid_existingFile_nonValid() throws IOException { File existingFile = tempFolder.newFile("filePath"); existingFile.createNewFile(); SaveModel temp = new SaveModel(true, existingFile.getAbsolutePath()); assertFalse(temp.isDirectoryValid()); }