When opening a repo in a dir that is a file then an exception is thrown

This commit is contained in:
Paul Campbell 2018-06-02 11:03:20 +01:00
parent 4895350c6b
commit 0c00a57ddb

View file

@ -124,11 +124,20 @@ class GitDBTest implements WithAssertions {
//then //then
assertThatExceptionOfType(GitDBRepoNotFoundException.class) assertThatExceptionOfType(GitDBRepoNotFoundException.class)
.isThrownBy(() -> GitDB.openLocal(dir)) .isThrownBy(() -> GitDB.openLocal(dir))
.withMessageContaining("GitDB repo not found")
.withMessageContaining(dir.toString()); .withMessageContaining(dir.toString());
} }
// When opening a repo in a dir that is a file then an exception is thrown // 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 doesn't exist then an exception is thrown
// When opening a repo in a dir that is a bare repo then GitDb is returned // When opening a repo in a dir that is a bare repo then GitDb is returned