Package org.mockserver.grpc
Class GrpcBidiRuleMatcher
java.lang.Object
org.mockserver.grpc.GrpcBidiRuleMatcher
Transport-neutral helper that matches an inbound gRPC bidi message (as JSON)
against a
GrpcBidiRule's matchJson pattern.
Shared by the HTTP/2 bidi handler (GrpcBidiStreamHandler) and the HTTP/3
bidi handler (Http3GrpcBidiStreamHandler) so the matching semantics are
identical across transports:
- a
null/empty pattern matches everything; - exact string equality is tried first;
- then a regex match using
Pattern.DOTALL(so'.'matches the newlines that protobuf'sJsonFormat.printer()emits in multiline JSON); - an invalid regex never matches (rather than throwing);
NottableString.isNot()inverts the result.
-
Method Summary
-
Method Details
-
matches
- Parameters:
rule- the bidi rule whosematchJsonpattern is evaluatedinboundJson- the inbound message converted to JSON- Returns:
trueif the rule matches the inbound message
-