Package reactor.test
Interface StepVerifier.ContextExpectations<T>
- Type Parameters:
T- the type of the sequence
- Enclosing interface:
- StepVerifier
public static interface StepVerifier.ContextExpectations<T>
Allow to set expectations about the
Context propagated during the Subscription
phase. You then need to resume to the StepVerifier assertion of the sequence
by using then().-
Method Summary
Modifier and TypeMethodDescriptionassertThat(Consumer<Context> assertingConsumer) Apply custom assertions to the propagatedContext.Check that the propagatedContextcontains the given value associated to the given key.containsAllOf(Map<?, ?> other) containsAllOf(Context other) containsOnly(Map<?, ?> other) containsOnly(Context other) Check that the propagatedContextcontains a value for the given key.hasSize(int size) Check that the propagatedContextis of the given size.then()Add the context checks set up by thisStepVerifier.ContextExpectationsas aStepVerifierexpectation, and return the currentStepVerifier.Stepin order to build further sequence expectations and ultimatelyverifythe sequence.
-
Method Details
-
hasKey
Check that the propagatedContextcontains a value for the given key.- Parameters:
key- the key to check- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
hasSize
Check that the propagatedContextis of the given size.- Parameters:
size- the expected size- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
contains
Check that the propagatedContextcontains the given value associated to the given key.- Parameters:
key- the key to check forvalue- the expected value for that key- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
containsAllOf
- Parameters:
other- the otherContextwhose key-value pairs are expected to be all contained by the propagated Context.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
containsAllOf
- Parameters:
other- the otherMapwhose key-value pairs are expected to be all contained by the propagatedContext.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
containsOnly
Check that the propagatedContextcontains all of the key-value pairs of the givenContext, and nothing else.- Parameters:
other- theContextrepresenting the exact expected content of the propagated Context.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
containsOnly
Check that the propagatedContextcontains all of the key-value pairs of the givenMap, and nothing else.- Parameters:
other- theMaprepresenting the exact expected content of the propagatedContext.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
assertThat
Apply custom assertions to the propagatedContext.- Parameters:
assertingConsumer- aConsumerfor theContextthat applies custom assertions.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
matches
- Parameters:
predicate- aPredicateto test with theContext.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
matches
- Parameters:
predicate- aPredicateto test with theContextdescription- the description for the Predicate, which will be part of theAssertionErrorif the predicate fails.- Returns:
- this
StepVerifier.ContextExpectationsfor further Context checking
-
then
StepVerifier.Step<T> then()Add the context checks set up by thisStepVerifier.ContextExpectationsas aStepVerifierexpectation, and return the currentStepVerifier.Stepin order to build further sequence expectations and ultimatelyverifythe sequence.- Returns:
- the
StepVerifier.Stepfor further building of expectations.
-