Skip to content

Commit

Permalink
feat: update mongodb template integration
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Dec 15, 2024
1 parent ffbf44d commit 8da4169
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ void shouldUpdateNullValues(){
});
}

@Test
void shouldCreateMongoDBBook() {
var id = randomUUID();
var title = "Persistence with MongoDB";
var author = "Otavio Santana";
var book = template.insert(new MongoDBBook(id, title, author));

SoftAssertions.assertSoftly(softly -> {
softly.assertThat(book).isNotNull();
softly.assertThat(book.id()).isEqualTo(id);
softly.assertThat(book.title()).isEqualTo(title);
softly.assertThat(book.author()).isEqualTo(author);
});
}

@Test
void shouldFindByUUID() {
var id = randomUUID();
var title = "Persistence with MongoDB";
var author = "Otavio Santana";
var book = template.insert(new MongoDBBook(id, title, author));

var optional = template.find(MongoDBBook.class, id);
assertThat(optional).isPresent();
assertThat(optional.get().id()).isEqualTo(id);
assertThat(optional.get().title()).isEqualTo(title);
assertThat(optional.get().author()).isEqualTo(author);
}


}

0 comments on commit 8da4169

Please sign in to comment.