Class RequestPatternBuilderImpl<ReqT>
- All Implemented Interfaces:
BuilderStep,HeadersMatcherBuilderStep<RequestPatternBuilderStep<ReqT>>,RequestMatcherBuilderStep<RequestPatternBuilderStep<ReqT>,,ReqT> StatusMatcherBuilderStep<RequestPatternBuilderStep<ReqT>>,StreamRequestMatcherBuilderStep<RequestPatternBuilderStep<ReqT>,,ReqT> RequestPatternBuilderStep<ReqT>
RequestPattern to define conditions for CapturedRequest matching.- Author:
- Fadelis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aRequestPatternwith given configuration.voidwithHeader(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.withRequests(Predicate<List<ReqT>> requestsPredicate) Adds a requests' matcher, which checks if all received stream requests satisfies givenPredicate.withStatus(Predicate<io.grpc.Status> predicate) Adds a closeStatusmatcher, which will check if the close status satisfies given predicate.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.matcher.steps.RequestMatcherBuilderStep
withRequestMethods inherited from interface org.grpcmock.definitions.matcher.steps.StatusMatcherBuilderStep
withStatusCode, withStatusMessage, withStatusOkMethods inherited from interface org.grpcmock.definitions.matcher.steps.StreamRequestMatcherBuilderStep
withFirstRequest, withFirstRequest, withNumberOfRequests, withRequestAtIndex, withRequestAtIndex, withRequests, withRequests, withRequestsContaining, withRequestsContaining
-
Constructor Details
-
RequestPatternBuilderImpl
-
-
Method Details
-
withStatus
Description copied from interface:StatusMatcherBuilderStepAdds a close
Statusmatcher, which will check if the close status satisfies given predicate.The status inside the predicate might be
nullif the request has not finished during the match invocation.Subsequent status matchers will be added as additional conditions.
- Specified by:
withStatusin interfaceStatusMatcherBuilderStep<ReqT>
-
withHeader
public <T> RequestPatternBuilderImpl<ReqT> 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
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<RequestPatternBuilderStep<ReqT>,ReqT>
-
withRequests
public RequestPatternBuilderStep<ReqT> withRequests(@Nonnull Predicate<List<ReqT>> requestsPredicate) Description copied from interface:StreamRequestMatcherBuilderStepAdds a requests' matcher, which checks if all received stream requests satisfies given
Predicate.Only applicable to client and bidi streaming methods.
Subsequent requests matchers will be added as additional conditions.
- Specified by:
withRequestsin interfaceStreamRequestMatcherBuilderStep<RequestPatternBuilderStep<ReqT>,ReqT>
-
clearRequestsPredicates
public void clearRequestsPredicates() -
build
Description copied from interface:RequestPatternBuilderStepBuilds aRequestPatternwith given configuration.- Specified by:
buildin interfaceRequestPatternBuilderStep<ReqT>
-