Class ServerStreamingMethodStubBuilderImpl<ReqT,RespT>
- All Implemented Interfaces:
BuilderStep,HeadersMatcherBuilderStep<ServerStreamingMethodStubBuilderStep<ReqT,,RespT>> RequestMatcherBuilderStep<ServerStreamingMethodStubBuilderStep<ReqT,,RespT>, ReqT> MethodStubBuilder<ReqT,,RespT> NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT> NextSingleRequestProxyResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT>, ReqT, RespT> NextSingleResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT>, ReqT, RespT> NextStreamResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT>, ReqT, RespT> ServerStreamingMethodStubBuilderStep<ReqT,,RespT> SingleRequestProxyResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT>, ReqT, RespT> SingleResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,,RespT>, RespT> StreamResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
- Author:
- Fadelis
-
Constructor Summary
ConstructorsConstructorDescriptionServerStreamingMethodStubBuilderImpl(io.grpc.MethodDescriptor<ReqT, RespT> method) -
Method Summary
Modifier and TypeMethodDescriptionbuild()nextWillProxyTo(BiConsumer<ReqT, io.grpc.stub.StreamObserver<RespT>> responseProxy) Defines a proxying response, which will proxy the request to givenResponsefor subsequent request call to this stub.nextWillReturn(ExceptionResponseActionBuilder response) Defines a exceptionResponsefor subsequent request call to this stub.nextWillReturn(ObjectResponseActionBuilder<RespT> response) Defines a singleResponsefor subsequent request call to this stub.nextWillReturn(StreamResponseBuilder<RespT> response) Defines a streamResponsefor subsequent request call that will execute multipleResponseAction.willProxyTo(BiConsumer<ReqT, io.grpc.stub.StreamObserver<RespT>> responseProxy) Defines a proxying response, which will proxy the request to givenResponse.willReturn(ExceptionResponseActionBuilder response) Defines a exceptionResponsethat will terminate the request.willReturn(ObjectResponseActionBuilder<RespT> response) Defines a singleResponsethat will be returned for the request and complete it.willReturn(StreamResponseBuilder<RespT> response) Defines a streamResponsethat will execute multipleResponseAction.withHeader(io.grpc.Metadata.Key<T> headerKey, Predicate<T> predicate) Adds a header matcher for the stub, which will trigger only if the given header has value satisfying givenPredicate.withRequest(Predicate<ReqT> requestPredicate) Adds a request matcher for the stub, which will trigger only if incoming request satisfies givenPredicate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.grpcmock.definitions.matcher.steps.HeadersMatcherBuilderStep
withHeader, withHeader, withHeader, withHeader, withoutHeader, withoutHeaderMethods inherited from interface org.grpcmock.definitions.stub.steps.NextSingleRequestProxyResponseBuilderStep
nextWillReturnMethods inherited from interface org.grpcmock.definitions.stub.steps.NextSingleResponseBuilderStep
nextWillReturn, nextWillReturnMethods inherited from interface org.grpcmock.definitions.stub.steps.NextStreamResponseBuilderStep
nextWillReturn, nextWillReturnMethods inherited from interface org.grpcmock.definitions.matcher.steps.RequestMatcherBuilderStep
withRequestMethods inherited from interface org.grpcmock.definitions.stub.steps.SingleRequestProxyResponseBuilderStep
willReturnMethods inherited from interface org.grpcmock.definitions.stub.steps.SingleResponseBuilderStep
willReturn, willReturnMethods inherited from interface org.grpcmock.definitions.stub.steps.StreamResponseBuilderStep
willReturn, willReturn
-
Constructor Details
-
ServerStreamingMethodStubBuilderImpl
-
-
Method Details
-
withHeader
public <T> ServerStreamingMethodStubBuilderStep<ReqT,RespT> withHeader(@Nonnull io.grpc.Metadata.Key<T> headerKey, @Nonnull Predicate<T> predicate) Description copied from interface:HeadersMatcherBuilderStepAdds a header matcher for the stub, which will trigger only if the given header has value satisfying given
Predicate.Subsequent matchers for the same header will replace the old one.
- Specified by:
withHeaderin interfaceHeadersMatcherBuilderStep<ReqT>
-
withRequest
public ServerStreamingMethodStubBuilderStep<ReqT,RespT> withRequest(@Nonnull Predicate<ReqT> requestPredicate) Description copied from interface:RequestMatcherBuilderStepAdds a request matcher for the stub, which will trigger only if incoming request satisfies given
Predicate.Only applicable to unary or server streaming methods.
Subsequent request matchers will replace the old one.
- Specified by:
withRequestin interfaceRequestMatcherBuilderStep<ReqT,RespT>
-
willReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> willReturn(@Nonnull ObjectResponseActionBuilder<RespT> response) Description copied from interface:SingleResponseBuilderStepDefines a singleResponsethat will be returned for the request and complete it.- Specified by:
willReturnin interfaceSingleResponseBuilderStep<ReqT,RespT>
-
willReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> willReturn(@Nonnull ExceptionResponseActionBuilder response) Description copied from interface:SingleResponseBuilderStepDefines a exceptionResponsethat will terminate the request.- Specified by:
willReturnin interfaceSingleResponseBuilderStep<ReqT,RespT>
-
willReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> willReturn(@Nonnull StreamResponseBuilder<RespT> response) Description copied from interface:StreamResponseBuilderStepDefines a streamResponsethat will execute multipleResponseAction.- Specified by:
willReturnin interfaceStreamResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
nextWillReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> nextWillReturn(@Nonnull StreamResponseBuilder<RespT> response) Description copied from interface:NextStreamResponseBuilderStepDefines a stream
Responsefor subsequent request call that will execute multipleResponseAction.If there are more requests coming in to this stub than responses defined, the last stream response defined will be returned for those requests.
- Specified by:
nextWillReturnin interfaceNextStreamResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
nextWillReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> nextWillReturn(@Nonnull ObjectResponseActionBuilder<RespT> response) Description copied from interface:NextSingleResponseBuilderStepDefines a single
Responsefor subsequent request call to this stub.If there are more requests coming in to this stub than responses defined, the last response defined will be returned for those requests.
- Specified by:
nextWillReturnin interfaceNextSingleResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
nextWillReturn
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> nextWillReturn(@Nonnull ExceptionResponseActionBuilder response) Description copied from interface:NextSingleResponseBuilderStepDefines a exception
Responsefor subsequent request call to this stub.If there are more requests coming in to this stub than responses defined, the last response defined will be returned for those requests.
- Specified by:
nextWillReturnin interfaceNextSingleResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
willProxyTo
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> willProxyTo(@Nonnull BiConsumer<ReqT, io.grpc.stub.StreamObserver<RespT>> responseProxy) Description copied from interface:SingleRequestProxyResponseBuilderStepDefines 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(); });- Specified by:
willProxyToin interfaceSingleRequestProxyResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
nextWillProxyTo
public NextServerStreamingMethodResponseBuilderStep<ReqT,RespT> nextWillProxyTo(@Nonnull BiConsumer<ReqT, io.grpc.stub.StreamObserver<RespT>> responseProxy) Description copied from interface:NextSingleRequestProxyResponseBuilderStepDefines a proxying response, which will proxy the request to given
Responsefor subsequent request call to this stub. 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:
.nextWillProxyTo((request, responseObserver) -> { responseObserver.onNext(responseObject); responseObserver.onCompleted(); });- Specified by:
nextWillProxyToin interfaceNextSingleRequestProxyResponseBuilderStep<NextServerStreamingMethodResponseBuilderStep<ReqT,RespT>, ReqT, RespT>
-
build
- Specified by:
buildin interfaceMethodStubBuilder<ReqT,RespT>
-