Search in sources :

Example 1 with TransformStatusServerCall

use of org.sonarlint.daemon.interceptors.ExceptionInterceptor.TransformStatusServerCall in project sonarlint-core by SonarSource.

the class ExceptionInterceptorTest method transformStatus.

private Status transformStatus(Exception cause) {
    ArgumentCaptor<Status> argument = ArgumentCaptor.forClass(Status.class);
    ServerCall<Void, Void> delegate = mock(ServerCall.class);
    Status status = Status.UNKNOWN.withCause(cause);
    assertThat(status.getDescription()).isNull();
    Metadata trailers = new Metadata();
    TransformStatusServerCall<Void, Void> serverCall = new TransformStatusServerCall<>(delegate);
    serverCall.close(status, trailers);
    verify(delegate).close(argument.capture(), any(Metadata.class));
    return argument.getValue();
}
Also used : Status(io.grpc.Status) TransformStatusServerCall(org.sonarlint.daemon.interceptors.ExceptionInterceptor.TransformStatusServerCall) Metadata(io.grpc.Metadata)

Aggregations

Metadata (io.grpc.Metadata)1 Status (io.grpc.Status)1 TransformStatusServerCall (org.sonarlint.daemon.interceptors.ExceptionInterceptor.TransformStatusServerCall)1