|
|
@@ -57,4 +57,25 @@ public class DirConverterBehaviorTest {
|
|
|
verify(fileConverter).convertToUpperCase(emptyFilePath.toString());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void testConvertDirNonExistentDirectory() {
|
|
|
+ Exception exception = assertThrows(IOException.class, () -> {
|
|
|
+ dirConverter.convertDir("non/existent/directory", FILE_EXTENSION);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void testConvertDirNonMatchingExtension() throws IOException {
|
|
|
+ Files.write(Paths.get(TEST_DIR, "file1.md"), "markdown content".getBytes());
|
|
|
+
|
|
|
+ dirConverter.convertDir(TEST_DIR, FILE_EXTENSION);
|
|
|
+
|
|
|
+ verify(fileConverter).convertToUpperCase(Paths.get(TEST_DIR, "file1.txt").toString());
|
|
|
+ verify(fileConverter).convertToUpperCase(Paths.get(TEST_DIR, "file2.txt").toString());
|
|
|
+ verify(fileConverter).convertToUpperCase(Paths.get(TEST_DIR, "file3.txt").toString());
|
|
|
+ verify(fileConverter, never()).convertToUpperCase(Paths.get(TEST_DIR, "file1.md").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|