From 0c00a57ddb7a4e8f5e3a2368d8a2c1aa2c46ffb0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 2 Jun 2018 11:03:20 +0100 Subject: [PATCH] When opening a repo in a dir that is a file then an exception is thrown --- src/test/java/net/kemitix/gitdb/GitDBTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/kemitix/gitdb/GitDBTest.java b/src/test/java/net/kemitix/gitdb/GitDBTest.java index 7619bbb..37bf247 100644 --- a/src/test/java/net/kemitix/gitdb/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/GitDBTest.java @@ -124,11 +124,20 @@ class GitDBTest implements WithAssertions { //then assertThatExceptionOfType(GitDBRepoNotFoundException.class) .isThrownBy(() -> GitDB.openLocal(dir)) - .withMessageContaining("GitDB repo not found") .withMessageContaining(dir.toString()); } // When opening a repo in a dir that is a file then an exception is thrown + @Test + void openRepo_whenDirIsFile_thenThrowException() throws IOException { + //given + final Path dir = fileExists(); + //then + assertThatExceptionOfType(GitDBRepoNotFoundException.class) + .isThrownBy(() -> GitDB.openLocal(dir)) + .withMessageContaining(dir.toString()); + } + // When opening a repo in a dir that doesn't exist then an exception is thrown // When opening a repo in a dir that is a bare repo then GitDb is returned