When start an anonymous transaction in a transaction then a new transaction is created
This commit is contained in:
parent
cdd35e8008
commit
c01936e55f
2 changed files with 15 additions and 2 deletions
|
@ -64,8 +64,8 @@ class GitDBTransactionImpl implements GitDBTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GitDBTransaction transaction() {
|
public GitDBTransaction transaction() throws IOException {
|
||||||
return null;
|
return branch.transaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -448,6 +448,19 @@ class GitDBTest implements WithAssertions {
|
||||||
assertThat(result).contains(value);
|
assertThat(result).contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When start an anonymous transaction in a transaction then a new transaction is created
|
||||||
|
@Test
|
||||||
|
void startAnonymousTransaction_whenTransaction_thenReturnAnotherTransaction() throws IOException {
|
||||||
|
//given
|
||||||
|
final GitDBBranch initialBranch = gitDBBranch();
|
||||||
|
final GitDBTransaction firstTransaction = initialBranch.transaction();
|
||||||
|
//when
|
||||||
|
final GitDBTransaction secondTransaction = firstTransaction.transaction();
|
||||||
|
//then
|
||||||
|
assertThat(secondTransaction).isNotNull();
|
||||||
|
assertThat(secondTransaction).isNotSameAs(firstTransaction);
|
||||||
|
}
|
||||||
|
|
||||||
// Given a GitDbTransaction handle with a added, updated and removed keys
|
// Given a GitDbTransaction handle with a added, updated and removed keys
|
||||||
// When closing the transaction an GitDbBranch is returned
|
// When closing the transaction an GitDbBranch is returned
|
||||||
// When closing the transaction the added key/value is found
|
// When closing the transaction the added key/value is found
|
||||||
|
|
Loading…
Reference in a new issue