Package io.quarkus.test.vertx
Class DefaultUniAsserter
- java.lang.Object
-
- io.quarkus.test.vertx.DefaultUniAsserter
-
- All Implemented Interfaces:
UniAsserter,UnwrappableUniAsserter
public final class DefaultUniAsserter extends Object implements UnwrappableUniAsserter
-
-
Field Summary
Fields Modifier and Type Field Description (package private) io.smallrye.mutiny.Uni<?>execution
-
Constructor Summary
Constructors Constructor Description DefaultUniAsserter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> UniAsserterassertEquals(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)Assert that the value of theUniis equal to the expected value.<T> UniAsserterassertFailedWith(Supplier<io.smallrye.mutiny.Uni<T>> uni, Class<? extends Throwable> c)Used to determine whether theUnicontains the expected failure type.<T> UniAsserterassertFailedWith(Supplier<io.smallrye.mutiny.Uni<T>> uni, Consumer<Throwable> c)Used to determine whether theUnicontains the expected failure.UniAsserterassertFalse(Supplier<io.smallrye.mutiny.Uni<Boolean>> uni)Assert that the value of theUniisfalse.<T> UniAsserterassertNotEquals(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)Assert that the value of theUniis not equal to the expected value.<T> UniAsserterassertNotNull(Supplier<io.smallrye.mutiny.Uni<T>> uni)Assert that the value of theUniis notnull.<T> UniAsserterassertNotSame(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)Assert that the value of theUniand the expected value do not refer to the same object.<T> UniAsserterassertNull(Supplier<io.smallrye.mutiny.Uni<T>> uni)Assert that the value of theUniisnull.<T> UniAsserterassertSame(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)Assert that the value of theUniand the expected value refer to the same object.<T> UniAsserterassertThat(Supplier<io.smallrye.mutiny.Uni<T>> uni, Consumer<T> asserter)Perform a custom assertion on the value of theUniin cases where no exception was thrown.UniAsserterassertTrue(Supplier<io.smallrye.mutiny.Uni<Boolean>> uni)Assert that the value of theUniistrue.io.smallrye.mutiny.Uni<?>asUni()voidclearData()Clear the test data.UniAsserterexecute(Runnable c)Execute some arbitrary operation as part of the pipeline.<T> UniAsserterexecute(Supplier<io.smallrye.mutiny.Uni<T>> uni)Execute some arbitrary operation as part of the pipeline.UniAsserterfail()Ensure that the whole pipeline always failsObjectgetData(String key)ObjectputData(String key, Object value)Associate the value with the given key.<T> UniAssertersurroundWith(Function<io.smallrye.mutiny.Uni<T>,io.smallrye.mutiny.Uni<T>> uni)
-
-
-
Method Detail
-
asUni
public io.smallrye.mutiny.Uni<?> asUni()
- Specified by:
asUniin interfaceUnwrappableUniAsserter- Returns:
- a
Unirepresenting the operations pipeline up to this point
-
assertThat
public <T> UniAsserter assertThat(Supplier<io.smallrye.mutiny.Uni<T>> uni, Consumer<T> asserter)
Description copied from interface:UniAsserterPerform a custom assertion on the value of theUniin cases where no exception was thrown.If an exception is expected, then one of
UniAsserter.assertFailedWith(java.util.function.Supplier<io.smallrye.mutiny.Uni<T>>, java.util.function.Consumer<java.lang.Throwable>)methods should be used.- Specified by:
assertThatin interfaceUniAsserter
-
execute
public <T> UniAsserter execute(Supplier<io.smallrye.mutiny.Uni<T>> uni)
Description copied from interface:UniAsserterExecute some arbitrary operation as part of the pipeline.- Specified by:
executein interfaceUniAsserter
-
execute
public UniAsserter execute(Runnable c)
Description copied from interface:UniAsserterExecute some arbitrary operation as part of the pipeline.- Specified by:
executein interfaceUniAsserter
-
assertEquals
public <T> UniAsserter assertEquals(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)
Description copied from interface:UniAsserterAssert that the value of theUniis equal to the expected value. If both arenull, they are considered equal.- Specified by:
assertEqualsin interfaceUniAsserter- See Also:
Object.equals(Object)
-
assertSame
public <T> UniAsserter assertSame(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)
Description copied from interface:UniAsserterAssert that the value of theUniand the expected value refer to the same object.- Specified by:
assertSamein interfaceUniAsserter
-
assertNull
public <T> UniAsserter assertNull(Supplier<io.smallrye.mutiny.Uni<T>> uni)
Description copied from interface:UniAsserterAssert that the value of theUniisnull.If an exception is expected, then one of
UniAsserter.assertFailedWith(java.util.function.Supplier<io.smallrye.mutiny.Uni<T>>, java.util.function.Consumer<java.lang.Throwable>)methods should be used.- Specified by:
assertNullin interfaceUniAsserter
-
assertNotEquals
public <T> UniAsserter assertNotEquals(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)
Description copied from interface:UniAsserterAssert that the value of theUniis not equal to the expected value. Fails if both arenull.- Specified by:
assertNotEqualsin interfaceUniAsserter- See Also:
Object.equals(Object)
-
assertNotSame
public <T> UniAsserter assertNotSame(Supplier<io.smallrye.mutiny.Uni<T>> uni, T t)
Description copied from interface:UniAsserterAssert that the value of theUniand the expected value do not refer to the same object.- Specified by:
assertNotSamein interfaceUniAsserter
-
assertNotNull
public <T> UniAsserter assertNotNull(Supplier<io.smallrye.mutiny.Uni<T>> uni)
Description copied from interface:UniAsserterAssert that the value of theUniis notnull.If an exception is expected, then one of
UniAsserter.assertFailedWith(java.util.function.Supplier<io.smallrye.mutiny.Uni<T>>, java.util.function.Consumer<java.lang.Throwable>)methods should be used.- Specified by:
assertNotNullin interfaceUniAsserter
-
surroundWith
public <T> UniAsserter surroundWith(Function<io.smallrye.mutiny.Uni<T>,io.smallrye.mutiny.Uni<T>> uni)
- Specified by:
surroundWithin interfaceUniAsserter
-
assertFalse
public UniAsserter assertFalse(Supplier<io.smallrye.mutiny.Uni<Boolean>> uni)
Description copied from interface:UniAsserterAssert that the value of theUniisfalse.- Specified by:
assertFalsein interfaceUniAsserter
-
assertTrue
public UniAsserter assertTrue(Supplier<io.smallrye.mutiny.Uni<Boolean>> uni)
Description copied from interface:UniAsserterAssert that the value of theUniistrue.- Specified by:
assertTruein interfaceUniAsserter
-
fail
public UniAsserter fail()
Description copied from interface:UniAsserterEnsure that the whole pipeline always fails- Specified by:
failin interfaceUniAsserter
-
assertFailedWith
public <T> UniAsserter assertFailedWith(Supplier<io.smallrye.mutiny.Uni<T>> uni, Consumer<Throwable> c)
Description copied from interface:UniAsserterUsed to determine whether theUnicontains the expected failure. The assertions fail if theUnidoes not fail.- Specified by:
assertFailedWithin interfaceUniAsserterc- Consumer that performs custom assertions on whether the failure matches expectations. This allows asserting on anything present in theThrowablelike, the cause or the message
-
assertFailedWith
public <T> UniAsserter assertFailedWith(Supplier<io.smallrye.mutiny.Uni<T>> uni, Class<? extends Throwable> c)
Description copied from interface:UniAsserterUsed to determine whether theUnicontains the expected failure type. The assertions fail if theUnidoes not fail.- Specified by:
assertFailedWithin interfaceUniAsserter
-
getData
public Object getData(String key)
- Specified by:
getDatain interfaceUniAsserter- Returns:
- the test data associated with the given key, or
null - See Also:
UniAsserter.putData(String, Object)
-
putData
public Object putData(String key, Object value)
Description copied from interface:UniAsserterAssociate the value with the given key.- Specified by:
putDatain interfaceUniAsserter- Returns:
- the previous value, or
nullif there was no data for the given key
-
clearData
public void clearData()
Description copied from interface:UniAsserterClear the test data.- Specified by:
clearDatain interfaceUniAsserter
-
-