This commit is contained in:
Phillip Webb
2022-10-25 17:04:05 -07:00
parent 0f405c06bf
commit a59b6cb1f3
31 changed files with 208 additions and 153 deletions

View File

@@ -67,11 +67,21 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
this(SimpleRequestExpectationManager::new);
}
/**
* Crate a new {@link MockServerRestTemplateCustomizer} instance.
* @param expectationManager the expectation manager class to use
*/
public MockServerRestTemplateCustomizer(Class<? extends RequestExpectationManager> expectationManager) {
this(() -> BeanUtils.instantiateClass(expectationManager));
Assert.notNull(expectationManager, "ExpectationManager must not be null");
}
/**
* Crate a new {@link MockServerRestTemplateCustomizer} instance.
* @param expectationManagerSupplier a supplier that provides the
* {@link RequestExpectationManager} to use
* @since 3.0.0
*/
public MockServerRestTemplateCustomizer(Supplier<? extends RequestExpectationManager> expectationManagerSupplier) {
Assert.notNull(expectationManagerSupplier, "ExpectationManagerSupplier must not be null");
this.expectationManagerSupplier = expectationManagerSupplier;