Skip to content

Commit

Permalink
[hibernate#1979] Add tests for find with multiple ids
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Sep 16, 2024
1 parent 5ae62f7 commit 65f69c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ private static String nameFromResult(List<Object> rowSet) {
}
}

@Test
public void reactiveFindMultipleIds(VertxTestContext context) {
final GuineaPig rump = new GuineaPig( 55, "Rumpelstiltskin" );
final GuineaPig emma = new GuineaPig( 77, "Emma" );
test( context, populateDB()
.chain( () -> getMutinySessionFactory().withTransaction( s -> s.persistAll( emma, rump ) ) )
.chain( () -> getMutinySessionFactory().withTransaction( s -> s.find( GuineaPig.class, emma.getId(), rump.getId() ) )
)
.invoke( pigs -> {
org.assertj.core.api.Assertions.assertThat( pigs ).containsExactlyInAnyOrder( emma, rump );
} )
);
}

@Test
public void sessionClear(VertxTestContext context) {
final GuineaPig guineaPig = new GuineaPig( 81, "Perry" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ public void reactiveFind(VertxTestContext context) {
);
}

@Test
public void reactiveFindMultipleIds(VertxTestContext context) {
final GuineaPig rump = new GuineaPig( 55, "Rumpelstiltskin" );
final GuineaPig emma = new GuineaPig( 77, "Emma" );
test( context, populateDB()
.thenCompose( v -> getSessionFactory().withTransaction( s -> s.persist( emma, rump ) ) )
.thenCompose( v -> getSessionFactory().withTransaction( s -> s
.find( GuineaPig.class, emma.getId(), rump.getId() ) )
)
.thenAccept( pigs -> {
org.assertj.core.api.Assertions.assertThat( pigs ).containsExactlyInAnyOrder( emma, rump );
} )
);
}

@Test
public void sessionClear(VertxTestContext context) {
final GuineaPig guineaPig = new GuineaPig( 81, "Perry" );
Expand Down

0 comments on commit 65f69c3

Please sign in to comment.