Skip to content

Commit

Permalink
[hibernate#1932] Remove warnings from QueryTest
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Jun 11, 2024
1 parent b91fc3a commit 7ae0f47
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Timeout(value = 10, timeUnit = MINUTES)
public class QueryTest extends BaseReactiveTest {
Expand Down Expand Up @@ -407,10 +407,10 @@ public void testNativeProjectionQuery(VertxTestContext context) {
.thenAccept( books -> {
assertEquals( 3, books.size() );
books.forEach( tuple -> {
assertTrue( tuple instanceof Object[] );
assertInstanceOf( Object[].class, tuple );
assertEquals( 2, tuple.length );
assertTrue( tuple[0] instanceof String );
assertTrue( tuple[1] instanceof String );
assertInstanceOf( String.class, tuple[0] );
assertInstanceOf( String.class, tuple[1] );
} );
} )
.thenCompose( v -> openSession() )
Expand All @@ -425,41 +425,40 @@ public void testNativeProjectionQuery(VertxTestContext context) {
.thenAccept( list -> {
Object[] tuple = list.get( 0 );
assertEquals( 3, tuple.length );
assertTrue( tuple[0] instanceof String );
assertInstanceOf( String.class, tuple[0] );
} ) )
.thenCompose( vv -> session
.createNativeQuery( "select title from " + BOOK_TABLE )
.getResultList()
.thenAccept( list -> assertTrue( list.get( 0 ) instanceof String ) )
)
.thenAccept( list -> assertInstanceOf( String.class, list.get( 0 ) ) ) )
.thenCompose( vv -> session
.createNativeQuery( "select title from " + BOOK_TABLE, String.class )
.getResultList()
.thenAccept( list -> assertTrue( list.get( 0 ) instanceof String ) ) )
.thenAccept( list -> assertInstanceOf( String.class, list.get( 0 ) ) ) )
.thenCompose( vv -> session
.createNativeQuery( "select title, isbn, id from " + BOOK_TABLE )
.getResultList()
.thenAccept( list -> {
Object[] tuple = (Object[]) list.get( 0 );
assertEquals( 3, tuple.length );
assertTrue( tuple[0] instanceof String );
assertInstanceOf( String.class, tuple[0] );
} ) )
.thenCompose( vv -> session
.createNativeQuery( "select title, isbn, id from " + BOOK_TABLE, Object[].class )
.getResultList()
.thenAccept( list -> {
Object[] tuple = list.get( 0 );
assertEquals( 3, tuple.length );
assertTrue( tuple[0] instanceof String );
assertInstanceOf( String.class, tuple[0] );
} ) )
.thenCompose( vv -> session
.createNativeQuery( "select title, isbn, id from " + BOOK_TABLE, Tuple.class )
.getResultList()
.thenAccept( list -> {
Tuple tuple = list.get( 0 );
assertEquals( 3, tuple.toArray().length );
assertTrue( tuple.get( 0 ) instanceof String );
assertTrue( tuple.get( "isbn" ) instanceof String );
assertInstanceOf( String.class, tuple.get( 0 ) );
assertInstanceOf( String.class, tuple.get( "isbn" ) );
} ) )
)
);
Expand Down Expand Up @@ -488,10 +487,10 @@ public void testNamedHqlProjectionQuery(VertxTestContext context) {
.thenAccept( books -> {
assertEquals( 3, books.size() );
books.forEach( tuple -> {
assertTrue( tuple instanceof Object[] );
assertInstanceOf( Object[].class, tuple );
assertEquals( 2, tuple.length );
assertTrue( tuple[0] instanceof String );
assertTrue( tuple[1] instanceof String );
assertInstanceOf( String.class, tuple[0] );
assertInstanceOf( String.class, tuple[1] );
} );
} )

Expand Down Expand Up @@ -527,10 +526,10 @@ public void testNamedNativeProjectionQuery(VertxTestContext context) {
.thenAccept( books -> {
assertEquals( 3, books.size() );
books.forEach( tuple -> {
assertTrue( tuple instanceof Object[] );
assertInstanceOf( Object[].class, tuple );
assertEquals( 2, tuple.length );
assertTrue( tuple[0] instanceof String );
assertTrue( tuple[1] instanceof String );
assertInstanceOf( String.class, tuple[0] );
assertInstanceOf( String.class, tuple[1] );
} );
} )
);
Expand Down Expand Up @@ -573,7 +572,7 @@ public void testSingleResultQueryException(VertxTestContext context) {

} )
.handle( (r, x) -> {
assertTrue( x.getCause() instanceof NoResultException );
assertInstanceOf( NoResultException.class, x.getCause() );
return null;
} )
);
Expand Down

0 comments on commit 7ae0f47

Please sign in to comment.