Skip to content

Commit

Permalink
[quarkusio#36582] Add UnwrappableUni interface
Browse files Browse the repository at this point in the history
The goal is to extract the `asUni()` method from `UniAsserter`
  • Loading branch information
DavideD committed Oct 31, 2023
1 parent 4885731 commit 37cd352
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import io.smallrye.mutiny.Uni;

public final class DefaultUniAsserter implements UniAsserter {
public final class DefaultUniAsserter implements UnwrappableAsserter {

private final ConcurrentMap<String, Object> data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void run() {
private final Object testInstance;
private final Method targetMethod;
private final List<Object> methodArgs;
private final UniAsserter uniAsserter;
private final UnwrappableAsserter uniAsserter;
private final CompletableFuture<Object> future;

public RunTestMethodOnVertxEventLoopContextHandler(Object testInstance, Method targetMethod, List<Object> methodArgs,
Expand All @@ -165,7 +165,7 @@ public RunTestMethodOnVertxEventLoopContextHandler(Object testInstance, Method t
this.future = future;
this.targetMethod = targetMethod;
this.methodArgs = methodArgs;
this.uniAsserter = uniAsserter;
this.uniAsserter = (UnwrappableAsserter) uniAsserter;
}

@Override
Expand Down Expand Up @@ -219,14 +219,14 @@ public static class RunTestMethodOnVertxBlockingContextHandler implements Handle
private final Object testInstance;
private final Method targetMethod;
private final List<Object> methodArgs;
private final UniAsserter uniAsserter;
private final UnwrappableAsserter uniAsserter;

public RunTestMethodOnVertxBlockingContextHandler(Object testInstance, Method targetMethod, List<Object> methodArgs,
UniAsserter uniAsserter) {
this.testInstance = testInstance;
this.targetMethod = targetMethod;
this.methodArgs = methodArgs;
this.uniAsserter = uniAsserter;
this.uniAsserter = (UnwrappableAsserter) uniAsserter;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,4 @@ public interface UniAsserter {
* Clear the test data.
*/
void clearData();

/**
* @return a {@link Uni} representing the operations pipeline up to this point
*/
Uni<?> asUni();
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* </pre>
*
*/
public abstract class UniAsserterInterceptor implements UniAsserter {
public abstract class UniAsserterInterceptor implements UnwrappableAsserter {

private final UniAsserter delegate;

Expand Down Expand Up @@ -192,6 +192,6 @@ public void clearData() {

@Override
public Uni<?> asUni() {
return delegate.asUni();
return ((UnwrappableAsserter) delegate).asUni();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.quarkus.test.vertx;

import io.smallrye.mutiny.Uni;

/**
* A {@link UniAsserter} that exposes the internal {@link Uni}.
* <p>
* We've added this interface so that we don't expose the method {@link #asUni()} to the user
* </p>
*/
public interface UnwrappableAsserter extends UniAsserter {

/**
* @return a {@link Uni} representing the operations pipeline up to this point
*/
Uni<?> asUni();
}

0 comments on commit 37cd352

Please sign in to comment.