saveDocumentGivesSavedValue:wq

This commit is contained in:
Paul Campbell 2018-05-12 18:50:43 +01:00
parent 1b2d540078
commit 5c3a319b19
2 changed files with 16 additions and 2 deletions

View file

@ -53,7 +53,7 @@ class GitDBLocal implements GitDB {
@Override @Override
public <T> T save(Branch branch, Message message, Document<T> document, Author author) { public <T> T save(Branch branch, Message message, Document<T> document, Author author) {
return null; return document.getValue();
} }
@Override @Override

View file

@ -10,6 +10,7 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Comparator; import java.util.Comparator;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -17,6 +18,10 @@ class GitDBTest {
private final Path dbDir = Files.createTempDirectory("gitdb"); private final Path dbDir = Files.createTempDirectory("gitdb");
private final GitDB gitDB = GitDB.local(dbDir); 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 { GitDBTest() throws IOException, GitAPIException {
} }
@ -33,7 +38,16 @@ class GitDBTest {
assertThat(repository.getRefDatabase()).isNotNull(); assertThat(repository.getRefDatabase()).isNotNull();
} }
@Test
void saveDocumentGivesSavedValue() {
//given
final String value = UUID.randomUUID().toString();
final Document<String> document = Document.create(key, value);
//when
final String result = gitDB.save(master, message, document, author);
//then
assertThat(result).isEqualTo(value);
}
@AfterEach @AfterEach
void tearDown() throws IOException { void tearDown() throws IOException {