@Test public void testGetStringForNullDirectory() throws IOException { // Test error-handling 2 pwdtool.getStringForDirectory(null); assertNotEquals(0, pwdtool.getStatusCode()); }
@Test public void testGetStringForNonExistingDirectory() throws IOException { // Test error-handling 1 // Reference non-existing file File notExistsDir = new File("notexists"); pwdtool.getStringForDirectory(notExistsDir); assertNotEquals(0, pwdtool.getStatusCode()); }
@Test public void testGetStringForDirectory() throws IOException { // Test expected behavior // Create a tmp-file and get (existing) parent directory String existsDirString = File.createTempFile("exists", "tmp").getParent(); File existsDir = new File(existsDirString); String dirString = pwdtool.getStringForDirectory(existsDir); assertEquals(0, pwdtool.getStatusCode()); assertTrue(dirString.equals(existsDirString)); }