Uses of Class
org.mockserver.mock.Expectation
Packages that use Expectation
Package
Description
-
Uses of Expectation in org.mockserver.client
Methods in org.mockserver.client that return ExpectationModifier and TypeMethodDescriptionA2aMockBuilder.applyTo(MockServerClient client) LlmConversationBuilder.applyTo(MockServerClient client) Build all turn expectations and register them with the MockServerClient.LlmMockBuilder.applyTo(MockServerClient client) Build the expectation and register it with the MockServerClient.McpMockBuilder.applyTo(MockServerClient client) TurnBuilder.applyTo(MockServerClient client) Shortcut: build and register all turns with the MockServerClient.A2aMockBuilder.build()LlmConversationBuilder.build()Build all turn expectations without registering them.LlmMockBuilder.build()Build the expectation without registering it.McpMockBuilder.build()Return error when expectation is matchedForwardChainExpectation.forward(ExpectationForwardCallback expectationForwardCallback) Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matchedForwardChainExpectation.forward(ExpectationForwardCallback expectationForwardCallback, ExpectationForwardAndResponseCallback expectationForwardResponseCallback) Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matchedForwardChainExpectation.forward(ExpectationForwardCallback expectationForwardCallback, ExpectationForwardAndResponseCallback expectationForwardResponseCallback, Delay delay) Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matchedForwardChainExpectation.forward(ExpectationForwardCallback expectationForwardCallback, Delay delay) Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matchedForwardChainExpectation.forward(HttpClassCallback httpClassCallback) Call method on local class in same JVM implementing ExpectationResponseCallback to generate request to forward when expectation is matchedForwardChainExpectation.forward(HttpForward httpForward) Forward request to the specified host and port when expectation is matchedForwardChainExpectation.forward(HttpOverrideForwardedRequest httpOverrideForwardedRequest) Override fields, headers, and cookies etc in request being forwarded with specified fields, headers and cookies, etc in the specified request when expectation is matchedForwardChainExpectation.forward(HttpTemplate httpTemplate) Evaluate Velocity or JavaScript template to generate request to forward when expectation is matchedForwardChainExpectation.forwardWithFallback(HttpForwardWithFallback httpForwardWithFallback) Forward request to the upstream host and return a fallback response when the upstream returns a configured status code (default 5xx) or times out.ForwardChainExpectation.respond(List<HttpResponse> httpResponses) Set a list of responses to cycle through sequentially when expectation is matched.ForwardChainExpectation.respond(ExpectationResponseCallback expectationResponseCallback) Call method on object locally or remotely (over web socket) to generate response to return when expectation is matchedForwardChainExpectation.respond(ExpectationResponseCallback expectationResponseCallback, Delay delay) Call method on object locally or remotely (over web socket) to generate response to return when expectation is matchedForwardChainExpectation.respond(HttpClassCallback httpClassCallback) Call method on local class in same JVM implementing ExpectationResponseCallback to generate response to return when expectation is matchedForwardChainExpectation.respond(HttpResponse httpResponse) Return response when expectation is matchedForwardChainExpectation.respond(HttpTemplate httpTemplate) Evaluate Velocity or JavaScript template to generate response to return when expectation is matchedForwardChainExpectation.respondWithBinary(BinaryResponse binaryResponse) ForwardChainExpectation.respondWithDns(DnsResponse dnsResponse) ForwardChainExpectation.respondWithGrpcBidi(GrpcBidiResponse grpcBidiResponse) ForwardChainExpectation.respondWithGrpcStream(GrpcStreamResponse grpcStreamResponse) ForwardChainExpectation.respondWithLlm(HttpLlmResponse httpLlmResponse) ForwardChainExpectation.respondWithSse(HttpSseResponse httpSseResponse) ForwardChainExpectation.respondWithWebSocket(HttpWebSocketResponse httpWebSocketResponse) MockServerClient.retrieveActiveExpectations(RequestDefinition requestDefinition) Retrieve the active expectations match the httpRequest parameter, use null for the parameter to retrieve all expectationsMockServerClient.retrieveRecordedExpectations(RequestDefinition requestDefinition) Retrieve the request-response combinations that have been recorded as a list of expectations, only those that match the httpRequest parameter are returned, use null to retrieve all requestsMockServerClient.sendExpectation(Expectation... expectations) Deprecated.this is deprecated due to unclear naming, use method upsert(Expectation... expectations) insteadForwardChainExpectation.upsert()Submit the expectation to MockServer without setting any additional primary action.MockServerClient.upsert(Expectation... expectations) Specify one or more expectations to be create, or updated (if the id matches).MockServerClient.upsert(OpenAPIExpectation... openAPIExpectations) Specify OpenAPI and operations and responses to create matchers and example responsesMethods in org.mockserver.client with parameters of type ExpectationModifier and TypeMethodDescriptionMockServerClient.sendExpectation(Expectation... expectations) Deprecated.this is deprecated due to unclear naming, use method upsert(Expectation... expectations) insteadMockServerClient.upsert(Expectation... expectations) Specify one or more expectations to be create, or updated (if the id matches). -
Uses of Expectation in org.mockserver.codec
Constructors in org.mockserver.codec with parameters of type ExpectationModifierConstructorDescriptionJsonSchemaBodyDecoder(Configuration configuration, MockServerLogger mockServerLogger, Expectation expectation, HttpRequest httpRequest) -
Uses of Expectation in org.mockserver.examples.mockserver.initializer
Methods in org.mockserver.examples.mockserver.initializer that return Expectation -
Uses of Expectation in org.mockserver.fixture
Methods in org.mockserver.fixture that return ExpectationModifier and TypeMethodDescriptionSseAwareExpectationConverter.convert(Expectation[] expectations) Convert an array of expectations, making streaming responses SSE-aware.FixtureRedactor.redact(Expectation[] expectations) Redact sensitive headers in an array of expectations.Methods in org.mockserver.fixture with parameters of type ExpectationModifier and TypeMethodDescriptionSseAwareExpectationConverter.convert(Expectation[] expectations) Convert an array of expectations, making streaming responses SSE-aware.FixtureRedactor.redact(Expectation[] expectations) Redact sensitive headers in an array of expectations. -
Uses of Expectation in org.mockserver.imports
Methods in org.mockserver.imports that return types with arguments of type ExpectationModifier and TypeMethodDescriptionHarImporter.importExpectations(String harJson) Parses a HAR JSON string and returns one expectation per entry.PostmanCollectionImporter.importExpectations(String collectionJson) Parses a Postman Collection v2.x JSON string and returns one expectation per saved example response. -
Uses of Expectation in org.mockserver.lifecycle
Method parameters in org.mockserver.lifecycle with type arguments of type ExpectationModifier and TypeMethodDescriptionvoidExpectationsListener.updated(List<Expectation> expectations) -
Uses of Expectation in org.mockserver.llm
Methods in org.mockserver.llm that return types with arguments of type ExpectationMethod parameters in org.mockserver.llm with type arguments of type ExpectationModifier and TypeMethodDescriptionStubGenerationPromptBuilder.build(HttpRequest unmatchedRequest, List<Expectation> contextExpectations) StubGenerationResult.setSuggestions(List<Expectation> suggestions) -
Uses of Expectation in org.mockserver.log
Method parameters in org.mockserver.log with type arguments of type ExpectationModifier and TypeMethodDescriptionvoidMockServerEventLog.retrieveRecordedExpectations(RequestDefinition requestDefinition, Consumer<List<Expectation>> listConsumer) -
Uses of Expectation in org.mockserver.log.model
Methods in org.mockserver.log.model that return ExpectationMethods in org.mockserver.log.model with parameters of type Expectation -
Uses of Expectation in org.mockserver.matchers
Fields in org.mockserver.matchers declared as ExpectationMethods in org.mockserver.matchers that return ExpectationModifier and TypeMethodDescriptionAbstractHttpRequestMatcher.getExpectation()HttpRequestMatcher.getExpectation()Methods in org.mockserver.matchers with parameters of type ExpectationModifier and TypeMethodDescriptionMatcherBuilder.transformsToMatcher(Expectation expectation) booleanAbstractHttpRequestMatcher.update(Expectation expectation) booleanHttpRequestMatcher.update(Expectation expectation) -
Uses of Expectation in org.mockserver.metrics
Method parameters in org.mockserver.metrics with type arguments of type ExpectationModifier and TypeMethodDescriptionstatic voidMetrics.setActiveExpectationsSupplier(Supplier<List<Expectation>> supplier) Set the supplier of active expectations. -
Uses of Expectation in org.mockserver.mock
Methods in org.mockserver.mock that return ExpectationModifier and TypeMethodDescriptionRequestMatchers.add(Expectation expectation, MockServerMatcherNotifier.Cause cause) Expectation.clone()HttpState.firstMatchingEarlyExpectation(HttpRequest headersOnly) Returns the first expectation whose matcher has respondBeforeBody=true, has no body matcher, and matches the supplied headers-only request.RequestMatchers.firstMatchingEarlyExpectation(HttpRequest headersOnlyRequest) HttpState.firstMatchingExpectation(RequestDefinition request) RequestMatchers.firstMatchingExpectation(RequestDefinition requestDefinition) HttpState.peekFirstMatchingExpectation(RequestDefinition request) Side-effect-free probe: returns the first matching expectation WITHOUT consuming the match (no Times decrement, no scenario transition, no responseInProgress, no metrics).RequestMatchers.peekFirstMatchingExpectation(RequestDefinition requestDefinition) Side-effect-free probe: returns the first active expectation whose matcher matches the given request, WITHOUT consuming the match.RequestMatchers.postProcess(Expectation expectation) Expectation.thenForward(HttpClassCallback httpClassCallback) Expectation.thenForward(HttpForward httpForward) Expectation.thenForward(HttpObjectCallback httpObjectCallback) Expectation.thenForward(HttpOverrideForwardedRequest httpOverrideForwardedRequest) Expectation.thenForward(HttpTemplate httpTemplate) Expectation.thenForwardValidate(HttpForwardValidateAction httpForwardValidateAction) Expectation.thenForwardWithFallback(HttpForwardWithFallback httpForwardWithFallback) Expectation.thenRespond(List<HttpResponse> httpResponses) Expectation.thenRespond(HttpClassCallback httpClassCallback) Expectation.thenRespond(HttpObjectCallback httpObjectCallback) Expectation.thenRespond(HttpResponse httpResponse) Expectation.thenRespond(HttpTemplate httpTemplate) Expectation.thenRespondWithBinary(BinaryResponse binaryResponse) Expectation.thenRespondWithDns(DnsResponse dnsResponse) Expectation.thenRespondWithGrpcBidi(GrpcBidiResponse grpcBidiResponse) Expectation.thenRespondWithGrpcStream(GrpcStreamResponse grpcStreamResponse) Expectation.thenRespondWithLlm(HttpLlmResponse httpLlmResponse) Expectation.thenRespondWithSse(HttpSseResponse httpSseResponse) Expectation.thenRespondWithWebSocket(HttpWebSocketResponse httpWebSocketResponse) static ExpectationSpecify the OpenAPI and operationId to match against by URL or payload and string as follows:static ExpectationSpecify the OpenAPI and operationId to match against by URL or payload and string with a match priority as follows:static ExpectationExpectation.when(String specUrlOrPayload, String operationId, Times times, TimeToLive timeToLive) Specify the OpenAPI and operationId to match against by URL or payload and string for a limit number of times or time as follows:static ExpectationExpectation.when(String specUrlOrPayload, String operationId, Times times, TimeToLive timeToLive, int priority) Specify the OpenAPI and operationId to match against by URL or payload and string for a limit number of times or time and a match priority as follows:static ExpectationExpectation.when(HttpRequest httpRequest) Specify the HttpRequest to match against as follows:static ExpectationExpectation.when(HttpRequest httpRequest, int priority) Specify the HttpRequest to match against with a match priority as follows:static ExpectationExpectation.when(HttpRequest httpRequest, Times times, TimeToLive timeToLive) Specify the HttpRequest to match against for a limit number of times or time as follows:static ExpectationExpectation.when(HttpRequest httpRequest, Times times, TimeToLive timeToLive, int priority) Specify the HttpRequest to match against for a limit number of times or time and a match priority as follows:Expectation.withAfterActions(List<AfterAction> afterActions) Expectation.withAfterActions(AfterAction... afterActions) Expectation.withBeforeActions(List<AfterAction> beforeActions) Expectation.withBeforeActions(AfterAction... beforeActions) Expectation.withChaos(HttpChaosProfile chaos) Expectation.withCreated(long created) Expectation.withCrossProtocolScenario(CrossProtocolScenario scenario) Expectation.withCrossProtocolScenarios(List<CrossProtocolScenario> scenarios) Set id of this expectation which can be used to update this expectation later or for clearing or verifying by expectation id.Expectation.withIdIfNull(String id) Expectation.withNewScenarioState(String newScenarioState) Expectation.withPercentage(Integer percentage) Expectation.withPriority(int priority) Set priority of this expectation which is used to determine the matching order of expectations when a request is received.Expectation.withResponseMode(ResponseMode responseMode) Expectation.withScenarioName(String scenarioName) Expectation.withScenarioState(String scenarioState) Expectation.withSteps(List<ExpectationStep> steps) Expectation.withSteps(ExpectationStep... steps) Methods in org.mockserver.mock that return types with arguments of type ExpectationModifier and TypeMethodDescriptionHttpState.add(Expectation... expectations) HttpState.add(OpenAPIExpectation openAPIExpectation) HttpState.allMatchingExpectation(HttpRequest request) RequestMatchers.retrieveActiveExpectations(RequestDefinition requestDefinition) RequestMatchers.retrieveExpectationsMatchingRequest(RequestDefinition requestDefinition) Methods in org.mockserver.mock with parameters of type ExpectationModifier and TypeMethodDescriptionHttpState.add(Expectation... expectations) RequestMatchers.add(Expectation expectation, MockServerMatcherNotifier.Cause cause) voidHttpState.postProcess(Expectation expectation) RequestMatchers.postProcess(Expectation expectation) voidRequestMatchers.update(Expectation[] expectations, MockServerMatcherNotifier.Cause cause) -
Uses of Expectation in org.mockserver.mock.action.http
Methods in org.mockserver.mock.action.http with parameters of type ExpectationModifier and TypeMethodDescriptionvoidHttpActionHandler.processEarlyAction(HttpRequest request, Expectation expectation, io.netty.channel.ChannelHandlerContext ctx, ResponseWriter earlyResponseWriter, boolean synchronous) Dispatch an early-matched expectation before the request body has been received. -
Uses of Expectation in org.mockserver.mock.drift
Methods in org.mockserver.mock.drift with parameters of type ExpectationModifier and TypeMethodDescriptionvoidDriftAnalyzer.analyse(Expectation expectation, HttpResponse realResponse) Analyse the real forwarded response against the expectation's stub response. -
Uses of Expectation in org.mockserver.mock.mcp
Method parameters in org.mockserver.mock.mcp with type arguments of type ExpectationModifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ArrayNodeMcpToolSchemaGenerator.generate(List<Expectation> expectations) -
Uses of Expectation in org.mockserver.mock.pact
Method parameters in org.mockserver.mock.pact with type arguments of type Expectation -
Uses of Expectation in org.mockserver.mock.wsdl
Methods in org.mockserver.mock.wsdl that return types with arguments of type ExpectationModifier and TypeMethodDescriptionParses the given WSDL and returns one expectation per SOAP operation. -
Uses of Expectation in org.mockserver.oidc
Methods in org.mockserver.oidc that return types with arguments of type ExpectationModifier and TypeMethodDescriptionOidcProviderGenerator.generate(OidcProviderConfiguration config) Generates OIDC provider expectations from the given configuration. -
Uses of Expectation in org.mockserver.openapi
Methods in org.mockserver.openapi that return types with arguments of type Expectation -
Uses of Expectation in org.mockserver.persistence
Methods in org.mockserver.persistence with parameters of type ExpectationModifier and TypeMethodDescriptionExpectationFileSystemPersistence.serialize(Expectation... expectations) RecordedExpectationFileSystemPersistence.serialize(Expectation... expectations) Method parameters in org.mockserver.persistence with type arguments of type ExpectationModifier and TypeMethodDescriptionExpectationFileSystemPersistence.serialize(List<Expectation> expectations) RecordedExpectationFileSystemPersistence.serialize(List<Expectation> expectations) -
Uses of Expectation in org.mockserver.serialization
Methods in org.mockserver.serialization that return ExpectationModifier and TypeMethodDescriptionExpectationSerializer.deserialize(String jsonExpectation) ExpectationSerializer.deserializeArray(String jsonExpectations, boolean allowEmpty) ExpectationSerializer.deserializeArray(String jsonExpectations, boolean allowEmpty, BiFunction<String, List<Expectation>, List<Expectation>> expectationModifier) Methods in org.mockserver.serialization that return types with arguments of type ExpectationModifier and TypeMethodDescriptionOpenAPIExpectationSerializer.deserializeToExpectations(String jsonOpenAPIExpectation) ExpectationSerializer.supportsType()Methods in org.mockserver.serialization with parameters of type ExpectationModifier and TypeMethodDescriptionExpectationSerializer.serialize(Expectation expectation) ExpectationSerializer.serialize(Expectation... expectations) Method parameters in org.mockserver.serialization with type arguments of type ExpectationModifier and TypeMethodDescriptionExpectationSerializer.deserializeArray(String jsonExpectations, boolean allowEmpty, BiFunction<String, List<Expectation>, List<Expectation>> expectationModifier) ExpectationSerializer.deserializeArray(String jsonExpectations, boolean allowEmpty, BiFunction<String, List<Expectation>, List<Expectation>> expectationModifier) ExpectationSerializer.serialize(List<Expectation> expectations) byte[]ExpectationExportSerializer.serializeAsBrunoCollection(List<Expectation> expectations) ExpectationExportSerializer.serializeAsOpenApi(List<Expectation> expectations) ExpectationExportSerializer.serializeAsPostmanCollection(List<Expectation> expectations) -
Uses of Expectation in org.mockserver.serialization.java
Methods in org.mockserver.serialization.java with parameters of type ExpectationModifier and TypeMethodDescriptionExpectationToJavaSerializer.serialize(int numberOfSpacesToIndent, Expectation expectation) Method parameters in org.mockserver.serialization.java with type arguments of type ExpectationModifier and TypeMethodDescriptionExpectationToJavaSerializer.serialize(List<Expectation> expectations) -
Uses of Expectation in org.mockserver.serialization.model
Methods in org.mockserver.serialization.model that return ExpectationConstructors in org.mockserver.serialization.model with parameters of type Expectation -
Uses of Expectation in org.mockserver.server.initialize
Methods in org.mockserver.server.initialize that return ExpectationModifier and TypeMethodDescriptionExpectationInitializer.initializeExpectations()ExpectationInitializerLoader.loadExpectations()Methods in org.mockserver.server.initialize that return types with arguments of type ExpectationModifier and TypeMethodDescriptionExpectationInitializerLoader.retrieveExpectationsFromFile(String initialLogMessage, String expectationLogMessage, String completedLogMessage, MockServerMatcherNotifier.Cause.Type causeType) ExpectationInitializerLoader.retrieveExpectationsFromOpenAPIFile(String initialLogMessage, String exceptionLogMessage, String completedLogMessage, MockServerMatcherNotifier.Cause.Type causeType) -
Uses of Expectation in org.mockserver.state
Methods in org.mockserver.state that return ExpectationConstructors in org.mockserver.state with parameters of type Expectation