From cd700c01308cdb7bf88a7655e05be94c0b277ab6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 15 Jun 2018 18:45:26 +0100 Subject: [PATCH] When removing a key in a transaction then the original GitDbBRanch still finds it --- .../java/net/kemitix/gitdb/test/GitDBTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/kemitix/gitdb/test/GitDBTest.java b/src/test/java/net/kemitix/gitdb/test/GitDBTest.java index 10399bf..2738670 100644 --- a/src/test/java/net/kemitix/gitdb/test/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/test/GitDBTest.java @@ -394,7 +394,19 @@ class GitDBTest implements WithAssertions { assertThat(updatedBranch.get(key)).contains(value); } - // When removing a key then the original GitDbBRanch still finds it + // When removing a key in a transaction then the original GitDbBRanch still finds it + @Test + void removeKey_whenTransaction_thenOriginalBranchStillFinds() throws IOException { + //given + final String key = stringSupplier.get(); + final String value = stringSupplier.get(); + final GitDBBranch originalBranch = gitDBBranchWithKeyValue(key, value); + final GitDBTransaction transaction = originalBranch.transaction(); + //when + final GitDBBranch removed = transaction.remove(key); + //then + assertThat(originalBranch.get(key)).contains(value); + } // Given a GitDbTransaction handle with a added, updated and removed keys // When closing the transaction an GitDbBranch is returned