Skip to content

Commit 65f69c3

Browse files
committed
[hibernate#1979] Add tests for find with multiple ids
1 parent 5ae62f7 commit 65f69c3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/MutinySessionTest.java

+14
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ private static String nameFromResult(List<Object> rowSet) {
6868
}
6969
}
7070

71+
@Test
72+
public void reactiveFindMultipleIds(VertxTestContext context) {
73+
final GuineaPig rump = new GuineaPig( 55, "Rumpelstiltskin" );
74+
final GuineaPig emma = new GuineaPig( 77, "Emma" );
75+
test( context, populateDB()
76+
.chain( () -> getMutinySessionFactory().withTransaction( s -> s.persistAll( emma, rump ) ) )
77+
.chain( () -> getMutinySessionFactory().withTransaction( s -> s.find( GuineaPig.class, emma.getId(), rump.getId() ) )
78+
)
79+
.invoke( pigs -> {
80+
org.assertj.core.api.Assertions.assertThat( pigs ).containsExactlyInAnyOrder( emma, rump );
81+
} )
82+
);
83+
}
84+
7185
@Test
7286
public void sessionClear(VertxTestContext context) {
7387
final GuineaPig guineaPig = new GuineaPig( 81, "Perry" );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveSessionTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ public void reactiveFind(VertxTestContext context) {
7979
);
8080
}
8181

82+
@Test
83+
public void reactiveFindMultipleIds(VertxTestContext context) {
84+
final GuineaPig rump = new GuineaPig( 55, "Rumpelstiltskin" );
85+
final GuineaPig emma = new GuineaPig( 77, "Emma" );
86+
test( context, populateDB()
87+
.thenCompose( v -> getSessionFactory().withTransaction( s -> s.persist( emma, rump ) ) )
88+
.thenCompose( v -> getSessionFactory().withTransaction( s -> s
89+
.find( GuineaPig.class, emma.getId(), rump.getId() ) )
90+
)
91+
.thenAccept( pigs -> {
92+
org.assertj.core.api.Assertions.assertThat( pigs ).containsExactlyInAnyOrder( emma, rump );
93+
} )
94+
);
95+
}
96+
8297
@Test
8398
public void sessionClear(VertxTestContext context) {
8499
final GuineaPig guineaPig = new GuineaPig( 81, "Perry" );

0 commit comments

Comments
 (0)