From b75f228dd731197aa2e40d8dae8d07f47b44bb1d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 2 Jun 2018 11:05:07 +0100 Subject: [PATCH] When opening a repo in a dir that doesn't exist then an exception is thrown --- src/test/java/net/kemitix/gitdb/GitDBTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/net/kemitix/gitdb/GitDBTest.java b/src/test/java/net/kemitix/gitdb/GitDBTest.java index 37bf247..4258683 100644 --- a/src/test/java/net/kemitix/gitdb/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/GitDBTest.java @@ -139,6 +139,15 @@ class GitDBTest implements WithAssertions { } // When opening a repo in a dir that doesn't exist then an exception is thrown + @Test + void openRepo_whenDirNotExist_thenThrowException() throws IOException { + //given + final Path dir = dirDoesNotExist(); + //then + assertThatExceptionOfType(GitDBRepoNotFoundException.class) + .isThrownBy(() -> GitDB.openLocal(dir)) + .withMessageContaining(dir.toString()); + } // When opening a repo in a dir that is a bare repo then GitDb is returned