When get format version in transaction then the version is the same

This commit is contained in:
Paul Campbell 2018-06-15 18:53:50 +01:00
parent 791f82e16f
commit c506802224
2 changed files with 14 additions and 2 deletions

View file

@ -59,8 +59,8 @@ class GitDBTransactionImpl implements GitDBTransaction {
}
@Override
public Optional<Version> getFormatVersion() {
return Optional.empty();
public Optional<Version> getFormatVersion() throws IOException {
return branch.getFormatVersion();
}
@Override

View file

@ -422,6 +422,18 @@ class GitDBTest implements WithAssertions {
assertThat(removed.get(key)).isEmpty();
}
// When get format version in transaction then the version is the same
@Test
void getFormatVersion_whenTransaction_thenFormatIsSame() throws IOException {
//given
final GitDBBranch gitDBBranch = gitDBBranch();
final GitDBTransaction transaction = gitDBBranch.transaction();
//when
final Optional<Version> formatVersion = transaction.getFormatVersion();
//then
assertThat(formatVersion).contains(GitDB.VERSION);
}
// Given a GitDbTransaction handle with a added, updated and removed keys
// When closing the transaction an GitDbBranch is returned
// When closing the transaction the added key/value is found