Interface SingleRequestProxyResponseBuilderStep<BUILDER extends BuilderStep,ReqT,RespT>

All Superinterfaces:
BuilderStep, MethodStubBuilder<ReqT,RespT>
All Known Subinterfaces:
ServerStreamingMethodStubBuilderStep<ReqT,RespT>, UnaryMethodStubBuilderStep<ReqT,RespT>
All Known Implementing Classes:
ServerStreamingMethodStubBuilderImpl, UnaryMethodStubBuilderImpl

public interface SingleRequestProxyResponseBuilderStep<BUILDER extends BuilderStep,ReqT,RespT> extends BuilderStep, MethodStubBuilder<ReqT,RespT>
Author:
Fadelis
  • Method Summary

    Modifier and Type
    Method
    Description
    willProxyTo(BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)
    Defines a proxying response, which will proxy the request to given Response.
    default BUILDER
    willReturn(Function<ReqT,RespT> responseFunction)
    Defines a proxying response, which is built based on received request.

    Methods inherited from interface org.grpcmock.definitions.stub.steps.MethodStubBuilder

    build
  • Method Details

    • willProxyTo

      BUILDER willProxyTo(@Nonnull BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)

      Defines a proxying response, which will proxy the request to given Response. The user is responsible that the request is completed correctly.

      Should be used when there needs to be more logic in the response method than returning a simple response. For example:

       .willProxyTo((request, responseObserver) -> {
         responseObserver.onNext(responseObject);
         responseObserver.onCompleted();
       });
       
    • willReturn

      default BUILDER willReturn(@Nonnull Function<ReqT,RespT> responseFunction)
      Defines a proxying response, which is built based on received request.