Skip to content

Commit 6927dc2

Browse files
committed
[hibernate#712] Minor code clean up
* Replace deprecated method calls * Remove some Idea warnings * Replace with method reference * Change to static class a test entity
1 parent de5722d commit 6927dc2

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/impl/MutinySessionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <T> Uni<T> uni(Supplier<CompletionStage<T>> stageSupplier) {
5454
@Override
5555
public Uni<Void> flush() {
5656
// checkOpen();
57-
return uni( () -> delegate.reactiveFlush() );
57+
return uni( delegate::reactiveFlush );
5858
}
5959

6060
@Override

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public void withTransactionFindAfterFlushWithStages(TestContext context) {
7474
.persist( wc )
7575
.thenCompose( $ -> s.flush() )
7676
.thenCompose( $ -> s.find( Webcomic.class, wc.getId() ) )
77-
.thenAccept( found -> {
78-
context.assertEquals( wc, found );
79-
} )
77+
.thenAccept( found -> context.assertEquals( wc, found ) )
8078
)
8179
);
8280
}
@@ -87,8 +85,8 @@ public void withTransactionFindAfterFlushWithMutiny(TestContext context) {
8785
test( context, getMutinySessionFactory()
8886
.withTransaction( (s, tx) -> s
8987
.persist( wc )
90-
.then( () -> s.flush() )
91-
.then( () -> s.find( Webcomic.class, wc.getId() ) )
88+
.call( () -> s.flush() )
89+
.chain( () -> s.find( Webcomic.class, wc.getId() ) )
9290
.invoke( found -> {
9391
context.assertEquals( wc, found );
9492
} )
@@ -157,7 +155,7 @@ public int hashCode() {
157155

158156
@Override
159157
public String toString() {
160-
return new StringBuilder( title ).append( " by " ).append( creator ).toString();
158+
return title + " by " + creator;
161159
}
162160
}
163161
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void testDuplicateKeyException(TestContext context) {
5454
}
5555

5656
@Entity
57-
public class MyPerson {
57+
public static class MyPerson {
5858

5959
@Id
6060
public String name;

0 commit comments

Comments
 (0)