14
14
15
15
import org .junit .Test ;
16
16
17
- import io .smallrye .mutiny .Uni ;
18
17
import io .vertx .core .Context ;
19
18
import io .vertx .core .Vertx ;
20
19
import io .vertx .ext .unit .Async ;
@@ -89,9 +88,8 @@ public void testOnPersistWithMutiny(TestContext testContext) throws Exception {
89
88
newContext .runOnContext ( event -> test ( async , testContext , session
90
89
.persist ( new Competition ( "Cheese Rolling" ) )
91
90
.call ( session ::flush )
92
- .onItem ().invoke ( v -> testContext .fail ( "We were expecting an exception" ) )
93
- .onFailure ().recoverWithUni ( e -> Uni .createFrom ().voidItem ()
94
- .invoke ( () -> assertExceptionThrown ( e ) ) ) )
91
+ .onItem ().failWith ( () -> new AssertionError ( "No exception thrown" ) )
92
+ .onFailure ().recoverWithItem ( e -> assertExceptionThrown ( e ) ) )
95
93
);
96
94
}
97
95
@@ -108,9 +106,8 @@ public void testFindWithMutiny(TestContext testContext) throws Exception {
108
106
// Run test in the new context
109
107
newContext .runOnContext ( event -> test ( async , testContext , session
110
108
.find ( Competition .class , "Chess boxing" )
111
- .onItem ().invoke ( v -> testContext .fail ( "We were expecting an exception" ) )
112
- .onFailure ().recoverWithUni ( e -> Uni .createFrom ().voidItem ()
113
- .replaceWith ( () -> assertExceptionThrown ( e ) ) ) )
109
+ .onItem ().failWith ( () -> new AssertionError ( "No exception thrown" ) )
110
+ .onFailure ().recoverWithItem ( e -> assertExceptionThrown ( e ) ) )
114
111
);
115
112
}
116
113
0 commit comments