Skip to content

Commit

Permalink
test: create integration with mongodb at nullable scenario
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Nov 19, 2023
1 parent fc26272 commit 39e6e5b
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


import jakarta.inject.Inject;
import org.assertj.core.api.SoftAssertions;
import org.eclipse.jnosql.databases.mongodb.communication.MongoDBDocumentConfigurations;
import org.eclipse.jnosql.databases.mongodb.mapping.MongoDBTemplate;
import org.eclipse.jnosql.mapping.Convert;
Expand Down Expand Up @@ -122,5 +123,20 @@ void shouldDeleteAll(){
assertThat(template.select(Book.class).result()).isEmpty();
}

@Test
void shouldUpdateNullValues(){
var book = new Book(randomUUID().toString(), "Effective Java", 1);
template.insert(book);
template.update(new Book(book.id(), null, 2));
Optional<Book> optional = template.select(Book.class).where("id")
.eq(book.id()).singleResult();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(optional).isPresent();
softly.assertThat(optional).get().extracting(Book::title).isNull();
softly.assertThat(optional).get().extracting(Book::edition).isEqualTo(2);
});
}



}

0 comments on commit 39e6e5b

Please sign in to comment.