From 5c3a319b1947c53385e5142d079c2bff3b759838 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 12 May 2018 18:50:43 +0100 Subject: [PATCH] saveDocumentGivesSavedValue:wq --- src/main/java/net/kemitix/gitdb/GitDBLocal.java | 2 +- src/test/java/net/kemitix/gitdb/GitDBTest.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/kemitix/gitdb/GitDBLocal.java b/src/main/java/net/kemitix/gitdb/GitDBLocal.java index 5f6954c..148e5fd 100644 --- a/src/main/java/net/kemitix/gitdb/GitDBLocal.java +++ b/src/main/java/net/kemitix/gitdb/GitDBLocal.java @@ -53,7 +53,7 @@ class GitDBLocal implements GitDB { @Override public T save(Branch branch, Message message, Document document, Author author) { - return null; + return document.getValue(); } @Override diff --git a/src/test/java/net/kemitix/gitdb/GitDBTest.java b/src/test/java/net/kemitix/gitdb/GitDBTest.java index c9b4034..92cc2d8 100644 --- a/src/test/java/net/kemitix/gitdb/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/GitDBTest.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; +import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -17,6 +18,10 @@ class GitDBTest { private final Path dbDir = Files.createTempDirectory("gitdb"); private final GitDB gitDB = GitDB.local(dbDir); + private final Branch master = Branch.name("master"); + private final Message message = Message.message(UUID.randomUUID().toString()); + private final Key key = Key.name(UUID.randomUUID().toString()); + private final Author author = Author.name("junit"); GitDBTest() throws IOException, GitAPIException { } @@ -33,7 +38,16 @@ class GitDBTest { assertThat(repository.getRefDatabase()).isNotNull(); } - + @Test + void saveDocumentGivesSavedValue() { + //given + final String value = UUID.randomUUID().toString(); + final Document document = Document.create(key, value); + //when + final String result = gitDB.save(master, message, document, author); + //then + assertThat(result).isEqualTo(value); + } @AfterEach void tearDown() throws IOException {