Skip to content

Commit e834089

Browse files
committed
test stabilized
1 parent cd0d7da commit e834089

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/src/test/java/com/avast/grpc/jwt/server/JwtServerInterceptorTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
import io.grpc.ServerCall;
99
import io.grpc.ServerCallHandler;
1010
import java.util.concurrent.CompletableFuture;
11-
import java.util.concurrent.CompletionException;
1211
import java.util.concurrent.atomic.AtomicReference;
1312
import org.junit.Test;
1413

1514
public class JwtServerInterceptorTest {
1615

1716
JwtTokenParser<String> jwtTokenParser =
18-
jwtToken ->
19-
CompletableFuture.supplyAsync(
20-
() -> {
21-
if (jwtToken.equals("Invalid Token"))
22-
throw new CompletionException(new RuntimeException("invalid token"));
23-
return jwtToken;
24-
});
17+
jwtToken -> {
18+
if (jwtToken.equals("Invalid Token")) {
19+
CompletableFuture<String> res = new CompletableFuture<>();
20+
res.completeExceptionally(new RuntimeException("invalid token"));
21+
return res;
22+
}
23+
return CompletableFuture.completedFuture(jwtToken);
24+
};
2525
JwtServerInterceptor<String> target = new JwtServerInterceptor<>(jwtTokenParser);
2626
ServerCall<Object, Object> serverCall = (ServerCall<Object, Object>) mock(ServerCall.class);
2727
ServerCallHandler<Object, Object> next =

0 commit comments

Comments
 (0)