Skip to content

Commit 936cf6d

Browse files
committed
[#1504] Clean up tests
* Sort import * Format code
1 parent 4e0e548 commit 936cf6d

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
*/
66
package org.hibernate.reactive;
77

8-
import io.vertx.junit5.Timeout;
9-
import io.vertx.junit5.VertxTestContext;
8+
import java.io.Serializable;
9+
import java.util.Collection;
10+
import java.util.List;
1011

1112
import org.hibernate.Hibernate;
1213
import org.hibernate.annotations.Fetch;
1314
import org.hibernate.annotations.FetchMode;
1415

1516
import org.junit.jupiter.api.Test;
1617

18+
import io.vertx.junit5.Timeout;
19+
import io.vertx.junit5.VertxTestContext;
1720
import jakarta.persistence.CascadeType;
1821
import jakarta.persistence.Column;
1922
import jakarta.persistence.Entity;
@@ -23,10 +26,6 @@
2326
import jakarta.persistence.JoinColumn;
2427
import jakarta.persistence.ManyToOne;
2528

26-
import java.io.Serializable;
27-
import java.util.Collection;
28-
import java.util.List;
29-
3029
import static java.util.concurrent.TimeUnit.MINUTES;
3130
import static org.junit.jupiter.api.Assertions.assertEquals;
3231
import static org.junit.jupiter.api.Assertions.assertTrue;

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ protected Collection<Class<?>> annotatedEntities() {
5252
public void testFindSelect(VertxTestContext context) {
5353
Foo foo = new Foo( new Bar( "unique" ) );
5454
test( context, getSessionFactory()
55-
.withTransaction( session -> session
56-
.persist( foo )
57-
.thenCompose( v -> session.flush() )
58-
.thenAccept( v -> session.clear() )
59-
.thenCompose( v -> session.find( Foo.class, foo.id ) )
55+
.withTransaction( session -> session
56+
.persist( foo )
57+
.thenCompose( v -> session.flush() )
58+
.thenAccept( v -> session.clear() )
59+
.thenCompose( v -> session.find( Foo.class, foo.id ) )
6060
// .thenApply( result -> {
6161
// assertFalse( Hibernate.isInitialized( result.bar) );
6262
// return result;
6363
// } )
64-
.thenCompose( result -> session.fetch( result.bar ) )
65-
.thenAccept( bar -> assertEquals( "unique", bar.key ) ) )
64+
.thenCompose( result -> session.fetch( result.bar ) )
65+
.thenAccept( bar -> assertEquals( "unique", bar.key ) ) )
6666
);
6767
}
6868

@@ -76,7 +76,7 @@ public void testMergeDetached(VertxTestContext context) {
7676
.thenCompose( result -> getSessionFactory()
7777
.withTransaction( session -> session.fetch( result.bar )
7878
.thenAccept( b -> assertEquals( "unique2", b.key ) )
79-
) ) );
79+
) ) );
8080
}
8181

8282
@Test
@@ -85,12 +85,15 @@ public void testMergeReference(VertxTestContext context) {
8585
test( context, getSessionFactory()
8686
.withTransaction( session -> session.persist( bar ) )
8787
.thenCompose( i -> getSessionFactory()
88-
.withTransaction( session-> session.merge( new Foo( session.getReference( Bar.class, bar.id ) ) ) )
88+
.withTransaction( session -> session.merge( new Foo( session.getReference(
89+
Bar.class,
90+
bar.id
91+
) ) ) )
8992
)
9093
.thenCompose( result -> getSessionFactory()
91-
.withTransaction( session-> session.fetch( result.bar )
92-
.thenAccept( b -> assertEquals( "unique3", b.key ) )
93-
) ) );
94+
.withTransaction( session -> session.fetch( result.bar )
95+
.thenAccept( b -> assertEquals( "unique3", b.key ) )
96+
) ) );
9497
}
9598

9699
@Test
@@ -99,13 +102,13 @@ public void testPersistReference(VertxTestContext context) {
99102
test( context, getSessionFactory()
100103
.withTransaction( session -> session.persist( bar ) )
101104
.thenCompose( i -> getSessionFactory()
102-
.withTransaction( session-> {
105+
.withTransaction( session -> {
103106
Foo foo = new Foo( session.getReference( Bar.class, bar.id ) );
104107
return session.persist( foo ).thenApply( v -> foo );
105108
} )
106109
)
107110
.thenCompose( result -> getSessionFactory()
108-
.withTransaction( session-> session.fetch( result.bar )
111+
.withTransaction( session -> session.fetch( result.bar )
109112
.thenAccept( b -> assertEquals( "unique3", b.getKey() ) )
110113
) ) );
111114
}

0 commit comments

Comments
 (0)