Merge branch '2.7.x' into 3.0.x
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,8 +82,10 @@ class ObservabilityContextCustomizerFactory implements ContextCustomizerFactory
|
||||
public void customizeContext(ConfigurableApplicationContext context,
|
||||
MergedContextConfiguration mergedContextConfiguration) {
|
||||
if (this.disableMetrics) {
|
||||
TestPropertyValues.of("management.defaults.metrics.export.enabled=false",
|
||||
"management.simple.metrics.export.enabled=true").applyTo(context);
|
||||
TestPropertyValues
|
||||
.of("management.defaults.metrics.export.enabled=false",
|
||||
"management.simple.metrics.export.enabled=true")
|
||||
.applyTo(context);
|
||||
}
|
||||
if (this.disableTracing) {
|
||||
TestPropertyValues.of("management.tracing.enabled=false").applyTo(context);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,8 +31,10 @@ class DataCassandraTestContextBootstrapper extends SpringBootTestContextBootstra
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataCassandraTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataCassandraTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,8 +31,10 @@ class DataCouchbaseTestContextBootstrapper extends SpringBootTestContextBootstra
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataCouchbaseTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataCouchbaseTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,8 +31,10 @@ class DataElasticsearchTestContextBootstrapper extends SpringBootTestContextBoot
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataElasticsearchTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataElasticsearchTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataJdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataJdbcTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataJdbcTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataLdapTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataLdapTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataLdapTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataMongoTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataMongoTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataMongoTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataNeo4jTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataNeo4jTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataNeo4jTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataR2dbcTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataR2dbcTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataR2dbcTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataRedisTestContextBootstrapper extends SpringBootTestContextBootstrapper
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataRedisTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataRedisTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public abstract class StandardAnnotationCustomizableTypeExcludeFilter<A extends
|
||||
|
||||
protected StandardAnnotationCustomizableTypeExcludeFilter(Class<?> testClass) {
|
||||
this.annotation = MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(getAnnotationType());
|
||||
.get(getAnnotationType());
|
||||
}
|
||||
|
||||
protected final MergedAnnotation<A> getAnnotation() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ class TypeExcludeFiltersContextCustomizerFactory implements ContextCustomizerFac
|
||||
return null;
|
||||
}
|
||||
AnnotationDescriptor<TypeExcludeFilters> descriptor = TestContextAnnotationUtils
|
||||
.findAnnotationDescriptor(testClass, TypeExcludeFilters.class);
|
||||
.findAnnotationDescriptor(testClass, TypeExcludeFilters.class);
|
||||
Class<?>[] filterClasses = (descriptor != null) ? descriptor.getAnnotation().value() : NO_FILTERS;
|
||||
if (ObjectUtils.isEmpty(filterClasses)) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
* Copyright 2020-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,9 @@ class GraphQlTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, MergedAnnotations.SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(GraphQlTest.class).getValue("properties", String[].class).orElse(null);
|
||||
.get(GraphQlTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class JdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JdbcTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(JdbcTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class JooqTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JooqTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(JooqTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class JsonTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JsonTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(JsonTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class DataJpaTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataJpaTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(DataJpaTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,18 +64,20 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
|
||||
}
|
||||
|
||||
private void getProperties(Class<?> source, Map<String, Object> properties) {
|
||||
MergedAnnotations.from(source, SearchStrategy.SUPERCLASS).stream()
|
||||
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getType)).forEach((annotation) -> {
|
||||
Class<Annotation> type = annotation.getType();
|
||||
MergedAnnotation<?> typeMapping = MergedAnnotations.from(type).get(PropertyMapping.class,
|
||||
MergedAnnotation::isDirectlyPresent);
|
||||
String prefix = typeMapping.getValue(MergedAnnotation.VALUE, String.class).orElse("");
|
||||
SkipPropertyMapping defaultSkip = typeMapping.getValue("skip", SkipPropertyMapping.class)
|
||||
.orElse(SkipPropertyMapping.YES);
|
||||
for (Method attribute : type.getDeclaredMethods()) {
|
||||
collectProperties(prefix, defaultSkip, annotation, attribute, properties);
|
||||
}
|
||||
});
|
||||
MergedAnnotations.from(source, SearchStrategy.SUPERCLASS)
|
||||
.stream()
|
||||
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getType))
|
||||
.forEach((annotation) -> {
|
||||
Class<Annotation> type = annotation.getType();
|
||||
MergedAnnotation<?> typeMapping = MergedAnnotations.from(type)
|
||||
.get(PropertyMapping.class, MergedAnnotation::isDirectlyPresent);
|
||||
String prefix = typeMapping.getValue(MergedAnnotation.VALUE, String.class).orElse("");
|
||||
SkipPropertyMapping defaultSkip = typeMapping.getValue("skip", SkipPropertyMapping.class)
|
||||
.orElse(SkipPropertyMapping.YES);
|
||||
for (Method attribute : type.getDeclaredMethods()) {
|
||||
collectProperties(prefix, defaultSkip, annotation, attribute, properties);
|
||||
}
|
||||
});
|
||||
if (TestContextAnnotationUtils.searchEnclosingClass(source)) {
|
||||
getProperties(source.getEnclosingClass(), properties);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,8 +51,9 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
|
||||
if (!this.propertySource.isEmpty()) {
|
||||
context.getEnvironment().getPropertySources().addFirst(this.propertySource);
|
||||
}
|
||||
context.getBeanFactory().registerSingleton(PropertyMappingCheckBeanPostProcessor.class.getName(),
|
||||
new PropertyMappingCheckBeanPostProcessor());
|
||||
context.getBeanFactory()
|
||||
.registerSingleton(PropertyMappingCheckBeanPostProcessor.class.getName(),
|
||||
new PropertyMappingCheckBeanPostProcessor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,10 +77,12 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
Class<?> beanClass = bean.getClass();
|
||||
MergedAnnotations annotations = MergedAnnotations.from(beanClass, SearchStrategy.SUPERCLASS);
|
||||
Set<Class<?>> components = annotations.stream(Component.class).map(this::getRoot)
|
||||
.collect(Collectors.toSet());
|
||||
Set<Class<?>> propertyMappings = annotations.stream(PropertyMapping.class).map(this::getRoot)
|
||||
.collect(Collectors.toSet());
|
||||
Set<Class<?>> components = annotations.stream(Component.class)
|
||||
.map(this::getRoot)
|
||||
.collect(Collectors.toSet());
|
||||
Set<Class<?>> propertyMappings = annotations.stream(PropertyMapping.class)
|
||||
.map(this::getRoot)
|
||||
.collect(Collectors.toSet());
|
||||
if (!components.isEmpty() && !propertyMappings.isEmpty()) {
|
||||
throw new IllegalStateException("The @PropertyMapping " + getAnnotationsDescription(propertyMappings)
|
||||
+ " cannot be used in combination with the @Component "
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,9 +62,9 @@ public class RestDocsAutoConfiguration {
|
||||
ObjectProvider<RestDocsMockMvcConfigurationCustomizer> configurationCustomizers,
|
||||
RestDocumentationContextProvider contextProvider) {
|
||||
MockMvcRestDocumentationConfigurer configurer = MockMvcRestDocumentation
|
||||
.documentationConfiguration(contextProvider);
|
||||
.documentationConfiguration(contextProvider);
|
||||
configurationCustomizers.orderedStream()
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
return configurer;
|
||||
}
|
||||
|
||||
@@ -88,9 +88,9 @@ public class RestDocsAutoConfiguration {
|
||||
ObjectProvider<RestDocsRestAssuredConfigurationCustomizer> configurationCustomizers,
|
||||
RestDocumentationContextProvider contextProvider) {
|
||||
RestAssuredRestDocumentationConfigurer configurer = RestAssuredRestDocumentation
|
||||
.documentationConfiguration(contextProvider);
|
||||
.documentationConfiguration(contextProvider);
|
||||
configurationCustomizers.orderedStream()
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
return new RequestSpecBuilder().addFilter(configurer).build();
|
||||
}
|
||||
|
||||
@@ -114,9 +114,9 @@ public class RestDocsAutoConfiguration {
|
||||
ObjectProvider<RestDocsWebTestClientConfigurationCustomizer> configurationCustomizers,
|
||||
RestDocumentationContextProvider contextProvider) {
|
||||
WebTestClientRestDocumentationConfigurer configurer = WebTestClientRestDocumentation
|
||||
.documentationConfiguration(contextProvider);
|
||||
.documentationConfiguration(contextProvider);
|
||||
configurationCustomizers.orderedStream()
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
|
||||
return configurer;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,8 +43,8 @@ class RestDocsRestAssuredBuilderCustomizer implements InitializingBean {
|
||||
PropertyMapper map = PropertyMapper.get();
|
||||
String host = this.properties.getUriHost();
|
||||
map.from(this.properties::getUriScheme)
|
||||
.when((scheme) -> StringUtils.hasText(scheme) && StringUtils.hasText(host))
|
||||
.to((scheme) -> this.delegate.baseUri(scheme + "://" + host));
|
||||
.when((scheme) -> StringUtils.hasText(scheme) && StringUtils.hasText(host))
|
||||
.to((scheme) -> this.delegate.baseUri(scheme + "://" + host));
|
||||
map.from(this.properties::getUriPort).whenNonNull().to(this.delegate::port);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,9 +37,9 @@ class RestDocumentationContextProviderRegistrar implements ImportBeanDefinitionR
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
Map<String, Object> annotationAttributes = importingClassMetadata
|
||||
.getAnnotationAttributes(AutoConfigureRestDocs.class.getName());
|
||||
.getAnnotationAttributes(AutoConfigureRestDocs.class.getName());
|
||||
BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ManualRestDocumentation.class);
|
||||
.genericBeanDefinition(ManualRestDocumentation.class);
|
||||
String outputDir = (String) annotationAttributes.get("outputDir");
|
||||
if (StringUtils.hasText(outputDir)) {
|
||||
definitionBuilder.addConstructorArgValue(outputDir);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,7 @@ public class MockRestServiceServerAutoConfiguration {
|
||||
private MockRestServiceServer createDeferredMockRestServiceServer(MockServerRestTemplateCustomizer customizer)
|
||||
throws Exception {
|
||||
Constructor<MockRestServiceServer> constructor = MockRestServiceServer.class
|
||||
.getDeclaredConstructor(RequestExpectationManager.class);
|
||||
.getDeclaredConstructor(RequestExpectationManager.class);
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(new DeferredRequestExpectationManager(customizer));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,8 +30,10 @@ class RestClientTestContextBootstrapper extends SpringBootTestContextBootstrappe
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(RestClientTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(RestClientTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,8 +38,10 @@ class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebFluxTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(WebFluxTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,7 +132,7 @@ public class MockMvcAutoConfiguration {
|
||||
dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());
|
||||
dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());
|
||||
dispatcherServlet
|
||||
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
|
||||
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public class MockMvcWebDriverAutoConfiguration {
|
||||
@ConditionalOnBean(MockMvc.class)
|
||||
public MockMvcHtmlUnitDriverBuilder mockMvcHtmlUnitDriverBuilder(MockMvc mockMvc, Environment environment) {
|
||||
return MockMvcHtmlUnitDriverBuilder.mockMvcSetup(mockMvc)
|
||||
.withDelegate(new LocalHostWebConnectionHtmlUnitDriver(environment, BrowserVersion.CHROME));
|
||||
.withDelegate(new LocalHostWebConnectionHtmlUnitDriver(environment, BrowserVersion.CHROME));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -107,9 +107,10 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
|
||||
|
||||
private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
|
||||
FilterRegistrationBeans registrations = new FilterRegistrationBeans(this.context);
|
||||
registrations.stream().map(AbstractFilterRegistrationBean.class::cast)
|
||||
.filter(AbstractFilterRegistrationBean<?>::isEnabled)
|
||||
.forEach((registration) -> addFilter(builder, registration));
|
||||
registrations.stream()
|
||||
.map(AbstractFilterRegistrationBean.class::cast)
|
||||
.filter(AbstractFilterRegistrationBean<?>::isEnabled)
|
||||
.forEach((registration) -> addFilter(builder, registration));
|
||||
}
|
||||
|
||||
private void addFilter(ConfigurableMockMvcBuilder<?> builder, AbstractFilterRegistrationBean<?> registration) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,8 +40,10 @@ class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebMvcTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(WebMvcTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,8 +31,10 @@ class WebServiceClientTestContextBootstrapper extends SpringBootTestContextBoots
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebServiceClientTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(WebServiceClientTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,8 +39,10 @@ class WebServiceServerTestContextBootstrapper extends SpringBootTestContextBoots
|
||||
|
||||
@Override
|
||||
protected String[] getProperties(Class<?> testClass) {
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebServiceServerTest.class)
|
||||
.getValue("properties", String[].class).orElse(null);
|
||||
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
|
||||
.get(WebServiceServerTest.class)
|
||||
.getValue("properties", String[].class)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ public final class AutoConfigurationImportedCondition extends Condition<Applicat
|
||||
@Override
|
||||
public boolean matches(ApplicationContext context) {
|
||||
ConditionEvaluationReport report = ConditionEvaluationReport
|
||||
.get((ConfigurableListableBeanFactory) context.getAutowireCapableBeanFactory());
|
||||
.get((ConfigurableListableBeanFactory) context.getAutowireCapableBeanFactory());
|
||||
return report.getConditionAndOutcomesBySource().containsKey(this.autoConfigurationClass.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,8 +46,9 @@ class ConditionReportApplicationContextFailureProcessorTests {
|
||||
ConfigurableApplicationContext applicationContext = application.run();
|
||||
ConditionReportApplicationContextFailureProcessor processor = new ConditionReportApplicationContextFailureProcessor();
|
||||
processor.processLoadFailure(applicationContext, new IllegalStateException());
|
||||
assertThat(output).contains("CONDITIONS EVALUATION REPORT").contains("Positive matches")
|
||||
.contains("Negative matches");
|
||||
assertThat(output).contains("CONDITIONS EVALUATION REPORT")
|
||||
.contains("Positive matches")
|
||||
.contains("Negative matches");
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -106,11 +106,12 @@ class ObservabilityContextCustomizerFactoryTests {
|
||||
try (FilteredClassLoader filteredClassLoader = new FilteredClassLoader("io.micrometer.tracing")) {
|
||||
ContextCustomizer customizer = createContextCustomizer(NoAnnotation.class);
|
||||
new ApplicationContextRunner().withClassLoader(filteredClassLoader)
|
||||
.withInitializer(applyCustomizer(customizer)).run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(Tracer.class);
|
||||
assertThatMetricsAreDisabled(context);
|
||||
assertThatTracingIsDisabled(context);
|
||||
});
|
||||
.withInitializer(applyCustomizer(customizer))
|
||||
.run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(Tracer.class);
|
||||
assertThatMetricsAreDisabled(context);
|
||||
assertThatTracingIsDisabled(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,18 +119,19 @@ class ObservabilityContextCustomizerFactoryTests {
|
||||
void shouldBackOffOnCustomTracer() {
|
||||
ContextCustomizer customizer = createContextCustomizer(NoAnnotation.class);
|
||||
new ApplicationContextRunner().withConfiguration(UserConfigurations.of(CustomTracer.class))
|
||||
.withInitializer(applyCustomizer(customizer)).run((context) -> {
|
||||
assertThat(context).hasSingleBean(Tracer.class);
|
||||
assertThat(context).hasBean("customTracer");
|
||||
});
|
||||
.withInitializer(applyCustomizer(customizer))
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(Tracer.class);
|
||||
assertThat(context).hasBean("customTracer");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotRunIfAotIsEnabled() {
|
||||
ContextCustomizer customizer = createContextCustomizer(NoAnnotation.class);
|
||||
new ApplicationContextRunner().withSystemProperties("spring.aot.enabled:true")
|
||||
.withInitializer(applyCustomizer(customizer))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(Tracer.class));
|
||||
.withInitializer(applyCustomizer(customizer))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(Tracer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -160,7 +162,7 @@ class ObservabilityContextCustomizerFactoryTests {
|
||||
|
||||
private void assertThatMetricsAreDisabled(ConfigurableApplicationContext context) {
|
||||
assertThat(context.getEnvironment().getProperty("management.defaults.metrics.export.enabled"))
|
||||
.isEqualTo("false");
|
||||
.isEqualTo("false");
|
||||
assertThat(context.getEnvironment().getProperty("management.simple.metrics.export.enabled")).isEqualTo("true");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,7 +78,8 @@ class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
|
||||
|
||||
private void executeTests(Class<?> testClass) {
|
||||
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
|
||||
.selectors(DiscoverySelectors.selectClass(testClass)).build();
|
||||
.selectors(DiscoverySelectors.selectClass(testClass))
|
||||
.build();
|
||||
Launcher launcher = LauncherFactory.create();
|
||||
launcher.execute(request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ class DataCassandraTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,8 +48,9 @@ class DataCouchbaseTestIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void couchbaseProperties(DynamicPropertyRegistry registry) {
|
||||
@@ -71,7 +72,7 @@ class DataCouchbaseTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,8 +46,9 @@ class DataCouchbaseTestReactiveIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void couchbaseProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,8 +47,9 @@ class DataCouchbaseTestWithIncludeFilterIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10))
|
||||
.withBucket(new BucketDefinition(BUCKET_NAME));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void couchbaseProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,7 +46,8 @@ class DataElasticsearchTestIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void elasticsearchProperties(DynamicPropertyRegistry registry) {
|
||||
@@ -65,7 +66,7 @@ class DataElasticsearchTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,8 @@ class DataElasticsearchTestPropertiesIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void elasticsearchProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,8 @@ class DataElasticsearchTestReactiveIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void elasticsearchProperties(DynamicPropertyRegistry registry) {
|
||||
@@ -63,7 +64,7 @@ class DataElasticsearchTestReactiveIntegrationTests {
|
||||
exampleDocument = this.exampleReactiveRepository.save(exampleDocument).block(Duration.ofSeconds(30));
|
||||
assertThat(exampleDocument.getId()).isNotNull();
|
||||
assertThat(this.elasticsearchTemplate.exists(exampleDocument.getId(), ExampleDocument.class)
|
||||
.block(Duration.ofSeconds(30))).isTrue();
|
||||
.block(Duration.ofSeconds(30))).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,8 @@ class DataElasticsearchTestWithIncludeFilterIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void elasticsearchProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ class DataJdbcTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleComponent() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -57,15 +57,15 @@ class DataLdapTestIntegrationTests {
|
||||
Optional<ExampleEntry> entry = this.exampleRepository.findOne(ldapQuery);
|
||||
assertThat(entry).isPresent();
|
||||
assertThat(entry.get().getDn())
|
||||
.isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"));
|
||||
.isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"));
|
||||
assertThat(this.ldapTemplate.findOne(ldapQuery, ExampleEntry.class).getDn())
|
||||
.isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"));
|
||||
.isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ class DataMongoTestIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
|
||||
@Autowired
|
||||
private MongoTemplate mongoTemplate;
|
||||
@@ -68,7 +68,7 @@ class DataMongoTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
@DynamicPropertySource
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ class DataMongoTestReactiveIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
|
||||
@Autowired
|
||||
private ReactiveMongoTemplate mongoTemplate;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ class DataMongoTestWithIncludeFilterIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
|
||||
@Autowired
|
||||
private ExampleService service;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ class TransactionalDataMongoTestIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
.withStartupTimeout(Duration.ofMinutes(5));
|
||||
|
||||
@Autowired
|
||||
private ExampleRepository exampleRepository;
|
||||
|
||||
@@ -47,7 +47,8 @@ class DataNeo4jTestIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void neo4jProperties(DynamicPropertyRegistry registry) {
|
||||
@@ -75,7 +76,7 @@ class DataNeo4jTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,8 @@ class DataNeo4jTestPropertiesIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void neo4jProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,7 +56,8 @@ class DataNeo4jTestReactiveIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void neo4jProperties(DynamicPropertyRegistry registry) {
|
||||
@@ -74,15 +75,18 @@ class DataNeo4jTestReactiveIntegrationTests {
|
||||
|
||||
@Test
|
||||
void testRepository() {
|
||||
Mono.just(new ExampleGraph("Look, new @DataNeo4jTest with reactive!")).flatMap(this.exampleRepository::save)
|
||||
.as(StepVerifier::create).expectNextCount(1).verifyComplete();
|
||||
Mono.just(new ExampleGraph("Look, new @DataNeo4jTest with reactive!"))
|
||||
.flatMap(this.exampleRepository::save)
|
||||
.as(StepVerifier::create)
|
||||
.expectNextCount(1)
|
||||
.verifyComplete();
|
||||
StepVerifier.create(this.neo4jTemplate.count(ExampleGraph.class)).expectNext(1L).verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,8 @@ class DataNeo4jTestWithIncludeFilterIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
.withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
@DynamicPropertySource
|
||||
static void neo4jProperties(DynamicPropertyRegistry registry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,14 +72,14 @@ class DataRedisTestIntegrationTests {
|
||||
PersonHash savedEntity = this.exampleRepository.save(personHash);
|
||||
assertThat(savedEntity.getId()).isNotNull();
|
||||
assertThat(this.operations.execute((RedisConnection connection) -> connection.keyCommands()
|
||||
.exists(("persons:" + savedEntity.getId()).getBytes(CHARSET)))).isTrue();
|
||||
.exists(("persons:" + savedEntity.getId()).getBytes(CHARSET)))).isTrue();
|
||||
this.exampleRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,17 +60,19 @@ class DataRedisTestReactiveIntegrationTests {
|
||||
@Test
|
||||
void testRepository() {
|
||||
String id = UUID.randomUUID().toString();
|
||||
StepVerifier.create(this.operations.opsForValue().set(id, "Hello World")).expectNext(Boolean.TRUE)
|
||||
.verifyComplete();
|
||||
StepVerifier.create(this.operations.opsForValue().set(id, "Hello World"))
|
||||
.expectNext(Boolean.TRUE)
|
||||
.verifyComplete();
|
||||
StepVerifier.create(this.operations.opsForValue().get(id)).expectNext("Hello World").verifyComplete();
|
||||
StepVerifier.create(this.operations.execute((action) -> action.serverCommands().flushDb())).expectNext("OK")
|
||||
.verifyComplete();
|
||||
StepVerifier.create(this.operations.execute((action) -> action.serverCommands().flushDb()))
|
||||
.expectNext("OK")
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
void didNotInjectExampleService() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleService.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ public class ExampleService {
|
||||
|
||||
public boolean hasRecord(PersonHash personHash) {
|
||||
return this.operations.execute((RedisConnection connection) -> connection.keyCommands()
|
||||
.exists(("persons:" + personHash.getId()).getBytes(CHARSET)));
|
||||
.exists(("persons:" + personHash.getId()).getBytes(CHARSET)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,8 +36,8 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
class GraphQlTesterAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().withConfiguration(
|
||||
AutoConfigurations.of(JacksonAutoConfiguration.class, GraphQlTesterAutoConfiguration.class));
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(JacksonAutoConfiguration.class, GraphQlTesterAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void shouldNotContributeTesterIfGraphQlServiceNotPresent() {
|
||||
@@ -47,7 +47,7 @@ class GraphQlTesterAutoConfigurationTests {
|
||||
@Test
|
||||
void shouldContributeTester() {
|
||||
this.contextRunner.withUserConfiguration(CustomGraphQlServiceConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasNotFailed().hasSingleBean(GraphQlTester.class));
|
||||
.run((context) -> assertThat(context).hasNotFailed().hasSingleBean(GraphQlTester.class));
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -73,7 +73,7 @@ class JdbcTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleRepository() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleRepository.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleRepository.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class TestDatabaseAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(TestDatabaseAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(TestDatabaseAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void replaceWithNoDataSourceAvailable() {
|
||||
@@ -65,8 +65,8 @@ class TestDatabaseAutoConfigurationTests {
|
||||
@Test
|
||||
void whenUsingAotGeneratedArtifactsEmbeddedDataSourceFactoryBeanIsNotDefined() {
|
||||
this.contextRunner.withUserConfiguration(ExistingDataSourceConfiguration.class)
|
||||
.withSystemProperties("spring.aot.enabled=true")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(EmbeddedDataSourceFactoryBean.class));
|
||||
.withSystemProperties("spring.aot.enabled=true")
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(EmbeddedDataSourceFactoryBean.class));
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ class JooqTestIntegrationTests {
|
||||
@Test
|
||||
void testDSLContext() {
|
||||
assertThat(this.dsl.selectCount().from("INFORMATION_SCHEMA.TABLES").fetchOne(0, Integer.class))
|
||||
.isGreaterThan(0);
|
||||
.isGreaterThan(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,7 +67,7 @@ class JooqTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleComponent() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -98,7 +98,8 @@ class JsonTestIntegrationTests {
|
||||
ExampleJsonObjectWithView object = new ExampleJsonObjectWithView();
|
||||
object.setValue("spring");
|
||||
JsonContent<ExampleJsonObjectWithView> content = this.jacksonWithViewJson
|
||||
.forView(ExampleJsonObjectWithView.TestView.class).write(object);
|
||||
.forView(ExampleJsonObjectWithView.TestView.class)
|
||||
.write(object);
|
||||
assertThat(content).doesNotHaveJsonPathValue("id");
|
||||
assertThat(content).isEqualToJson("example.json");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ class DataJpaTestAttributesIntegrationTests {
|
||||
@Test
|
||||
void bootstrapModeIsSet() {
|
||||
assertThat(this.environment.getProperty("spring.data.jpa.repositories.bootstrap-mode"))
|
||||
.isEqualTo(BootstrapMode.DEFERRED.name());
|
||||
.isEqualTo(BootstrapMode.DEFERRED.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,7 +94,7 @@ class DataJpaTestIntegrationTests {
|
||||
@Test
|
||||
void didNotInjectExampleComponent() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleComponent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,7 +110,7 @@ class DataJpaTestIntegrationTests {
|
||||
@Test
|
||||
void bootstrapModeIsDefaultByDefault() {
|
||||
assertThat(this.applicationContext.getEnvironment().getProperty("spring.data.jpa.repositories.bootstrap-mode"))
|
||||
.isEqualTo(BootstrapMode.DEFAULT.name());
|
||||
.isEqualTo(BootstrapMode.DEFAULT.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,8 @@ class DataJpaTestSchemaCredentialsIntegrationTests {
|
||||
String product = this.dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||
assertThat(product).isEqualTo("H2");
|
||||
assertThat(new JdbcTemplate(this.dataSource).queryForList("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES",
|
||||
String.class)).contains("EXAMPLE");
|
||||
String.class))
|
||||
.contains("EXAMPLE");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,15 +42,16 @@ import static org.mockito.Mockito.mock;
|
||||
class TestDatabaseAutoConfigurationNoEmbeddedTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withUserConfiguration(ExistingDataSourceConfiguration.class)
|
||||
.withConfiguration(AutoConfigurations.of(TestDatabaseAutoConfiguration.class));
|
||||
.withUserConfiguration(ExistingDataSourceConfiguration.class)
|
||||
.withConfiguration(AutoConfigurations.of(TestDatabaseAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void applyAnyReplace() {
|
||||
this.contextRunner.run((context) -> assertThat(context).getFailure().isInstanceOf(BeanCreationException.class)
|
||||
.hasMessageContaining("Failed to replace DataSource with an embedded database for tests.")
|
||||
.hasMessageContaining("If you want an embedded database please put a supported one on the classpath")
|
||||
.hasMessageContaining("or tune the replace attribute of @AutoConfigureTestDatabase."));
|
||||
this.contextRunner.run((context) -> assertThat(context).getFailure()
|
||||
.isInstanceOf(BeanCreationException.class)
|
||||
.hasMessageContaining("Failed to replace DataSource with an embedded database for tests.")
|
||||
.hasMessageContaining("If you want an embedded database please put a supported one on the classpath")
|
||||
.hasMessageContaining("or tune the replace attribute of @AutoConfigureTestDatabase."));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ class TestEntityManagerTests {
|
||||
@Test
|
||||
void createWhenEntityManagerIsNullShouldThrowException() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new TestEntityManager(null))
|
||||
.withMessageContaining("EntityManagerFactory must not be null");
|
||||
.withMessageContaining("EntityManagerFactory must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -191,8 +191,8 @@ class TestEntityManagerTests {
|
||||
given(this.entityManagerFactory.getPersistenceUnitUtil()).willReturn(this.persistenceUnitUtil);
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> this.testEntityManager.getId(entity, Long.class))
|
||||
.withMessageContaining("ID mismatch: Object of class [java.lang.Integer] "
|
||||
+ "must be an instance of class java.lang.Long");
|
||||
.withMessageContaining("ID mismatch: Object of class [java.lang.Integer] "
|
||||
+ "must be an instance of class java.lang.Long");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -213,7 +213,7 @@ class TestEntityManagerTests {
|
||||
@Test
|
||||
void getEntityManagerWhenNotSetShouldThrowException() {
|
||||
assertThatIllegalStateException().isThrownBy(this.testEntityManager::getEntityManager)
|
||||
.withMessageContaining("No transactional EntityManager found");
|
||||
.withMessageContaining("No transactional EntityManager found");
|
||||
}
|
||||
|
||||
private void bindEntityManager() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ class OverrideAutoConfigurationEnabledFalseIntegrationTests {
|
||||
ApplicationContext context = this.context;
|
||||
assertThat(context.getBean(ExampleTestConfig.class)).isNotNull();
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> context.getBean(ConfigurationPropertiesBindingPostProcessor.class));
|
||||
.isThrownBy(() -> context.getBean(ConfigurationPropertiesBindingPostProcessor.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ class AnnotationsPropertySourceTests {
|
||||
@Test
|
||||
void createWhenSourceIsNullShouldThrowException() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new AnnotationsPropertySource(null))
|
||||
.withMessageContaining("Property source must not be null");
|
||||
.withMessageContaining("Property source must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -92,9 +92,9 @@ class PropertyMappingContextCustomizerFactoryTests {
|
||||
context.register(ConfigMapping.class);
|
||||
customizer.customizeContext(context, null);
|
||||
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(context::refresh)
|
||||
.withMessageContaining("The @PropertyMapping annotation "
|
||||
+ "@PropertyMappingContextCustomizerFactoryTests.TypeMappingAnnotation "
|
||||
+ "cannot be used in combination with the @Component annotation @Configuration");
|
||||
.withMessageContaining("The @PropertyMapping annotation "
|
||||
+ "@PropertyMappingContextCustomizerFactoryTests.TypeMappingAnnotation "
|
||||
+ "cannot be used in combination with the @Component annotation @Configuration");
|
||||
}
|
||||
|
||||
@NoMappingAnnotation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,7 +69,8 @@ class MockMvcRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests {
|
||||
|
||||
@Test
|
||||
void snippetGeneration() throws Exception {
|
||||
this.mvc.perform(get("/")).andDo(this.documentationHandler
|
||||
this.mvc.perform(get("/"))
|
||||
.andDo(this.documentationHandler
|
||||
.document(links(linkWithRel("self").description("Canonical location of this resource"))));
|
||||
File defaultSnippetsDir = new File(this.generatedSnippets, "snippet-generation");
|
||||
assertThat(defaultSnippetsDir).exists();
|
||||
@@ -94,7 +95,7 @@ class MockMvcRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests {
|
||||
@Bean
|
||||
RestDocsMockMvcConfigurationCustomizer defaultSnippetsCustomizer() {
|
||||
return (configurer) -> configurer.snippets()
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -71,9 +71,14 @@ class RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests
|
||||
@Test
|
||||
void snippetGeneration() {
|
||||
given(this.documentationSpec)
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https").host("api.example.com").removePort())))
|
||||
.when().port(this.port).get("/").then().assertThat().statusCode(is(200));
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https").host("api.example.com").removePort())))
|
||||
.when()
|
||||
.port(this.port)
|
||||
.get("/")
|
||||
.then()
|
||||
.assertThat()
|
||||
.statusCode(is(200));
|
||||
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");
|
||||
assertThat(defaultSnippetsDir).exists();
|
||||
assertThat(contentOf(new File(defaultSnippetsDir, "curl-request.md"))).contains("'https://api.example.com/'");
|
||||
@@ -98,7 +103,7 @@ class RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests
|
||||
@Bean
|
||||
RestDocsRestAssuredConfigurationCustomizer defaultSnippetsCustomizer() {
|
||||
return (configurer) -> configurer.snippets()
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,9 +63,14 @@ class RestAssuredRestDocsAutoConfigurationIntegrationTests {
|
||||
@Test
|
||||
void defaultSnippetsAreWritten() {
|
||||
given(this.documentationSpec)
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https").host("api.example.com").removePort())))
|
||||
.when().port(this.port).get("/").then().assertThat().statusCode(is(200));
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https").host("api.example.com").removePort())))
|
||||
.when()
|
||||
.port(this.port)
|
||||
.get("/")
|
||||
.then()
|
||||
.assertThat()
|
||||
.statusCode(is(200));
|
||||
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");
|
||||
assertThat(defaultSnippetsDir).exists();
|
||||
assertThat(contentOf(new File(defaultSnippetsDir, "curl-request.adoc"))).contains("'https://api.example.com/'");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,8 +62,13 @@ class WebTestClientRestDocsAutoConfigurationAdvancedConfigurationIntegrationTest
|
||||
|
||||
@Test
|
||||
void defaultSnippetsAreWritten() {
|
||||
this.webTestClient.get().uri("/").exchange().expectStatus().is2xxSuccessful().expectBody()
|
||||
.consumeWith(document("default-snippets"));
|
||||
this.webTestClient.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.is2xxSuccessful()
|
||||
.expectBody()
|
||||
.consumeWith(document("default-snippets"));
|
||||
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");
|
||||
assertThat(defaultSnippetsDir).exists();
|
||||
assertThat(contentOf(new File(defaultSnippetsDir, "curl-request.md"))).contains("'https://api.example.com/'");
|
||||
@@ -88,7 +93,7 @@ class WebTestClientRestDocsAutoConfigurationAdvancedConfigurationIntegrationTest
|
||||
@Bean
|
||||
RestDocsWebTestClientConfigurationCustomizer defaultSnippetsCustomizer() {
|
||||
return (configurer) -> configurer.snippets()
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
.withAdditionalDefaults(responseFields(fieldWithPath("_links.self").description("Main URL")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,8 +55,13 @@ class WebTestClientRestDocsAutoConfigurationIntegrationTests {
|
||||
|
||||
@Test
|
||||
void defaultSnippetsAreWritten() {
|
||||
this.webTestClient.get().uri("/").exchange().expectStatus().is2xxSuccessful().expectBody()
|
||||
.consumeWith(document("default-snippets"));
|
||||
this.webTestClient.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.is2xxSuccessful()
|
||||
.expectBody()
|
||||
.consumeWith(document("default-snippets"));
|
||||
File defaultSnippetsDir = new File(this.generatedSnippets, "default-snippets");
|
||||
assertThat(defaultSnippetsDir).exists();
|
||||
assertThat(contentOf(new File(defaultSnippetsDir, "curl-request.adoc"))).contains("'https://api.example.com/'");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,9 +57,9 @@ class MockMvcSecurityIntegrationTests {
|
||||
@Test
|
||||
void okResponseWithBasicAuthCredentialsForKnownUser() throws Exception {
|
||||
this.mockMvc
|
||||
.perform(get("/").header(HttpHeaders.AUTHORIZATION,
|
||||
"Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes())))
|
||||
.andExpect(status().isOk());
|
||||
.perform(get("/").header(HttpHeaders.AUTHORIZATION,
|
||||
"Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes())))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ class AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests {
|
||||
@Test
|
||||
void mockServerRestTemplateCustomizerShouldNotBeRegistered() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(MockServerRestTemplateCustomizer.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(MockServerRestTemplateCustomizer.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,8 +55,9 @@ class RestClientRestIntegrationTests {
|
||||
|
||||
@Test
|
||||
void mockServerCallWithContent() {
|
||||
this.server.expect(requestTo("/test")).andExpect(content().string("test"))
|
||||
.andRespond(withSuccess("1", MediaType.TEXT_HTML));
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andExpect(content().string("test"))
|
||||
.andRespond(withSuccess("1", MediaType.TEXT_HTML));
|
||||
this.client.testPostWithBody("test");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,13 +50,13 @@ class RestClientTestNoComponentIntegrationTests {
|
||||
@Test
|
||||
void exampleRestClientIsNotInjected() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleRestClient.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleRestClient.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void examplePropertiesIsNotInjected() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleProperties.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleProperties.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,22 +50,25 @@ class RestClientTestTwoComponentsIntegrationTests {
|
||||
|
||||
@Test
|
||||
void serverShouldNotWork() {
|
||||
assertThatIllegalStateException().isThrownBy(
|
||||
() -> this.server.expect(requestTo("/test")).andRespond(withSuccess("hello", MediaType.TEXT_HTML)))
|
||||
.withMessageContaining("Unable to use auto-configured");
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(
|
||||
() -> this.server.expect(requestTo("/test")).andRespond(withSuccess("hello", MediaType.TEXT_HTML)))
|
||||
.withMessageContaining("Unable to use auto-configured");
|
||||
}
|
||||
|
||||
@Test
|
||||
void client1RestCallViaCustomizer() {
|
||||
this.customizer.getServer(this.client1.getRestTemplate()).expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
this.customizer.getServer(this.client1.getRestTemplate())
|
||||
.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
assertThat(this.client1.test()).isEqualTo("hello");
|
||||
}
|
||||
|
||||
@Test
|
||||
void client2RestCallViaCustomizer() {
|
||||
this.customizer.getServer(this.client2.getRestTemplate()).expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("there", MediaType.TEXT_HTML));
|
||||
this.customizer.getServer(this.client2.getRestTemplate())
|
||||
.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("there", MediaType.TEXT_HTML));
|
||||
assertThat(this.client2.test()).isEqualTo("there");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ class RestClientTestWithConfigurationPropertiesIntegrationTests {
|
||||
@Test
|
||||
void configurationPropertiesCanBeAddedAsComponent() {
|
||||
assertThat(this.applicationContext.getBeansOfType(ExampleProperties.class).keySet())
|
||||
.containsOnly("example-org.springframework.boot.test.autoconfigure.web.client.ExampleProperties");
|
||||
.containsOnly("example-org.springframework.boot.test.autoconfigure.web.client.ExampleProperties");
|
||||
assertThat(this.applicationContext.getBean(ExampleProperties.class).getName()).isEqualTo("Hello");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ import static org.mockito.Mockito.mock;
|
||||
class WebTestClientAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(WebTestClientAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(WebTestClientAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void shouldNotBeConfiguredWithoutWebHandler() {
|
||||
@@ -72,10 +72,11 @@ class WebTestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void shouldCustomizeTimeout() {
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||
.withPropertyValues("spring.test.webtestclient.timeout=15m").run((context) -> {
|
||||
WebTestClient webTestClient = context.getBean(WebTestClient.class);
|
||||
assertThat(webTestClient).hasFieldOrPropertyWithValue("responseTimeout", Duration.ofMinutes(15));
|
||||
});
|
||||
.withPropertyValues("spring.test.webtestclient.timeout=15m")
|
||||
.run((context) -> {
|
||||
WebTestClient webTestClient = context.getBean(WebTestClient.class);
|
||||
assertThat(webTestClient).hasFieldOrPropertyWithValue("responseTimeout", Duration.ofMinutes(15));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -97,17 +98,17 @@ class WebTestClientAutoConfigurationTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
void shouldNotApplySpringSecurityConfigurerWhenSpringSecurityNotOnClassPath() {
|
||||
FilteredClassLoader classLoader = new FilteredClassLoader(SecurityMockServerConfigurers.class);
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class).withClassLoader(classLoader)
|
||||
.run((context) -> {
|
||||
WebTestClient webTestClient = context.getBean(WebTestClient.class);
|
||||
WebTestClient.Builder builder = (WebTestClient.Builder) ReflectionTestUtils.getField(webTestClient,
|
||||
"builder");
|
||||
WebHttpHandlerBuilder httpHandlerBuilder = (WebHttpHandlerBuilder) ReflectionTestUtils
|
||||
.getField(builder, "httpHandlerBuilder");
|
||||
List<WebFilter> filters = (List<WebFilter>) ReflectionTestUtils.getField(httpHandlerBuilder,
|
||||
"filters");
|
||||
assertThat(filters).isEmpty();
|
||||
});
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||
.withClassLoader(classLoader)
|
||||
.run((context) -> {
|
||||
WebTestClient webTestClient = context.getBean(WebTestClient.class);
|
||||
WebTestClient.Builder builder = (WebTestClient.Builder) ReflectionTestUtils.getField(webTestClient,
|
||||
"builder");
|
||||
WebHttpHandlerBuilder httpHandlerBuilder = (WebHttpHandlerBuilder) ReflectionTestUtils.getField(builder,
|
||||
"httpHandlerBuilder");
|
||||
List<WebFilter> filters = (List<WebFilter>) ReflectionTestUtils.getField(httpHandlerBuilder, "filters");
|
||||
assertThat(filters).isEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -85,7 +85,7 @@ class WebFluxTestAutoConfigurationIntegrationTests {
|
||||
@Test
|
||||
void oAuth2ResourceServerAutoConfigurationWasImported() {
|
||||
assertThat(this.applicationContext)
|
||||
.has(importedAutoConfiguration(ReactiveOAuth2ResourceServerAutoConfiguration.class));
|
||||
.has(importedAutoConfiguration(ReactiveOAuth2ResourceServerAutoConfiguration.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,8 +40,13 @@ class WebFluxTestConverterIntegrationTests {
|
||||
@Test
|
||||
void shouldFindConverter() {
|
||||
UUID id = UUID.randomUUID();
|
||||
this.webClient.get().uri("/two/" + id).exchange().expectStatus().isOk().expectBody(String.class)
|
||||
.isEqualTo(id + "two");
|
||||
this.webClient.get()
|
||||
.uri("/two/" + id)
|
||||
.exchange()
|
||||
.expectStatus()
|
||||
.isOk()
|
||||
.expectBody(String.class)
|
||||
.isEqualTo(id + "two");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock;
|
||||
class MockMvcAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MockMvcAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(MockMvcAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void registersDispatcherServletFromMockMvc() {
|
||||
@@ -62,7 +62,7 @@ class MockMvcAutoConfigurationTests {
|
||||
@Test
|
||||
void shouldNotRegisterWebTestClientIfWebFluxMissing() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(WebClient.class))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(WebTestClient.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(WebTestClient.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,7 +71,7 @@ class MockMvcAutoConfigurationTests {
|
||||
assertThat(context).hasSingleBean(WebTestClient.class);
|
||||
assertThat(context).hasBean("myWebTestClientCustomizer");
|
||||
then(context.getBean("myWebTestClientCustomizer", WebTestClientBuilderCustomizer.class)).should()
|
||||
.customize(any(WebTestClient.Builder.class));
|
||||
.customize(any(WebTestClient.Builder.class));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,7 @@ class SpringBootMockMvcBuilderCustomizerTests {
|
||||
this.customizer = new SpringBootMockMvcBuilderCustomizer(context);
|
||||
this.customizer.customize(builder);
|
||||
FilterRegistrationBean<?> registrationBean = (FilterRegistrationBean<?>) context
|
||||
.getBean("filterRegistrationBean");
|
||||
.getBean("filterRegistrationBean");
|
||||
Filter testFilter = (Filter) context.getBean("testFilter");
|
||||
Filter otherTestFilter = registrationBean.getFilter();
|
||||
List<Filter> filters = (List<Filter>) ReflectionTestUtils.getField(builder, "filters");
|
||||
@@ -98,7 +98,7 @@ class SpringBootMockMvcBuilderCustomizerTests {
|
||||
|
||||
assertThat(delegate.allWritten).hasSize(10000);
|
||||
assertThat(delegate.allWritten)
|
||||
.allSatisfy((written) -> assertThat(written).containsExactly("1", "2", "3", "4", "5"));
|
||||
.allSatisfy((written) -> assertThat(written).containsExactly("1", "2", "3", "4", "5"));
|
||||
}
|
||||
|
||||
private static final class CapturingLinesWriter implements LinesWriter {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ class WebMvcTestAutoConfigurationIntegrationTests {
|
||||
void asyncTaskExecutorWithApplicationTaskExecutor() {
|
||||
assertThat(this.applicationContext.getBeansOfType(AsyncTaskExecutor.class)).hasSize(1);
|
||||
assertThat(this.applicationContext.getBean(RequestMappingHandlerAdapter.class)).extracting("taskExecutor")
|
||||
.isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
|
||||
.isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -71,7 +71,7 @@ class WebMvcTestAllControllersIntegrationTests {
|
||||
@Test
|
||||
void shouldRunValidationFailure() {
|
||||
assertThatExceptionOfType(ServletException.class).isThrownBy(() -> this.mvc.perform(get("/three/invalid")))
|
||||
.withCauseInstanceOf(ConstraintViolationException.class);
|
||||
.withCauseInstanceOf(ConstraintViolationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,8 +45,9 @@ class WebMvcTestCustomDispatcherServletIntegrationTests {
|
||||
|
||||
@Test
|
||||
void dispatcherServletIsCustomized() throws Exception {
|
||||
this.mvc.perform(get("/does-not-exist")).andExpect(status().isBadRequest())
|
||||
.andExpect(content().string("Invalid request: /does-not-exist"));
|
||||
this.mvc.perform(get("/does-not-exist"))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(content().string("Invalid request: /does-not-exist"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,13 +42,13 @@ class WebMvcTestHateoasIntegrationTests {
|
||||
@Test
|
||||
void plainResponse() throws Exception {
|
||||
this.mockMvc.perform(get("/hateoas/plain"))
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, "application/json"));
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, "application/json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void hateoasResponse() throws Exception {
|
||||
this.mockMvc.perform(get("/hateoas/resource"))
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, "application/hal+json"));
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, "application/hal+json"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,8 +61,9 @@ class WebMvcTestNestedIntegrationTests {
|
||||
|
||||
@Test
|
||||
void shouldFindController2() throws Exception {
|
||||
WebMvcTestNestedIntegrationTests.this.mvc.perform(get("/two")).andExpect(content().string("hellotwo"))
|
||||
.andExpect(status().isOk());
|
||||
WebMvcTestNestedIntegrationTests.this.mvc.perform(get("/two"))
|
||||
.andExpect(content().string("hellotwo"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,8 +41,9 @@ class WebMvcTestPageableIntegrationTests {
|
||||
|
||||
@Test
|
||||
void shouldSupportPageable() throws Exception {
|
||||
this.mvc.perform(get("/paged").param("page", "2").param("size", "42")).andExpect(status().isOk())
|
||||
.andExpect(content().string("2:42"));
|
||||
this.mvc.perform(get("/paged").param("page", "2").param("size", "42"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().string("2:42"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,8 @@ class WebMvcTestPrintDefaultIntegrationTests {
|
||||
|
||||
private void executeTests(Class<?> testClass) {
|
||||
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
|
||||
.selectors(DiscoverySelectors.selectClass(testClass)).build();
|
||||
.selectors(DiscoverySelectors.selectClass(testClass))
|
||||
.build();
|
||||
Launcher launcher = LauncherFactory.create();
|
||||
launcher.execute(request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,13 +56,13 @@ class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
|
||||
@Test
|
||||
void shouldNotHaveWebDriver() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.context.getBean(WebDriver.class));
|
||||
.isThrownBy(() -> this.context.getBean(WebDriver.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotHaveWebClient() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.context.getBean(WebClient.class));
|
||||
.isThrownBy(() -> this.context.getBean(WebClient.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ class AutoConfigureMockWebServiceServerEnabledIntegrationTests {
|
||||
@Test
|
||||
void mockWebServiceServerShouldNotBeRegistered() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(MockWebServiceServer.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(MockWebServiceServer.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ class AutoConfigureWebServiceClientWebServiceTemplateIntegrationTests {
|
||||
@Test
|
||||
void webServiceTemplateTest() {
|
||||
this.server.expect(payload(new StringSource("<request/>")))
|
||||
.andRespond(withPayload(new StringSource("<response/>")));
|
||||
.andRespond(withPayload(new StringSource("<response/>")));
|
||||
this.webServiceTemplate.marshalSendAndReceive("https://example.com", new Request());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ class WebServiceClientIntegrationTests {
|
||||
@Test
|
||||
void mockServerCall() {
|
||||
this.server.expect(payload(new StringSource("<request/>")))
|
||||
.andRespond(withPayload(new StringSource("<response><status>200</status></response>")));
|
||||
.andRespond(withPayload(new StringSource("<response><status>200</status></response>")));
|
||||
assertThat(this.client.test()).extracting(Response::getStatus).isEqualTo(200);
|
||||
}
|
||||
|
||||
@@ -56,14 +56,14 @@ class WebServiceClientIntegrationTests {
|
||||
void mockServerCall1() {
|
||||
this.server.expect(connectionTo("https://example1")).andRespond(withPayload(new StringSource("<response/>")));
|
||||
assertThatExceptionOfType(SourceAssertionError.class).isThrownBy(this.client::test)
|
||||
.withMessageContaining("Unexpected connection expected");
|
||||
.withMessageContaining("Unexpected connection expected");
|
||||
}
|
||||
|
||||
@Test
|
||||
void mockServerCall2() {
|
||||
this.server.expect(payload(new StringSource("<request/>"))).andRespond(withError("Invalid Request"));
|
||||
assertThatExceptionOfType(WebServiceTransportException.class).isThrownBy(this.client::test)
|
||||
.withMessageContaining("Invalid Request");
|
||||
.withMessageContaining("Invalid Request");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,14 +50,14 @@ class WebServiceClientNoComponentIntegrationTests {
|
||||
@Test
|
||||
void exampleClientIsNotInjected() {
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleWebServiceClient.class));
|
||||
.isThrownBy(() -> this.applicationContext.getBean(ExampleWebServiceClient.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void manuallyCreateBean() {
|
||||
ExampleWebServiceClient client = new ExampleWebServiceClient(this.webServiceTemplateBuilder);
|
||||
this.server.expect(payload(new StringSource("<request/>")))
|
||||
.andRespond(withPayload(new StringSource("<response><status>200</status></response>")));
|
||||
.andRespond(withPayload(new StringSource("<response><status>200</status></response>")));
|
||||
assertThat(client.test()).extracting(Response::getStatus).isEqualTo(200);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class MockWebServiceClientAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MockWebServiceClientAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(MockWebServiceClientAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void shouldRegisterMockWebServiceClient() {
|
||||
@@ -45,7 +45,7 @@ class MockWebServiceClientAutoConfigurationTests {
|
||||
FilteredClassLoader classLoader = new FilteredClassLoader(MockWebServiceClient.class);
|
||||
|
||||
this.contextRunner.withClassLoader(classLoader)
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MockWebServiceClient.class));
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(MockWebServiceClient.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,9 +38,8 @@ class WebServiceServerIntegrationTests {
|
||||
@Test
|
||||
void payloadRootMethod() {
|
||||
this.mock
|
||||
.sendRequest(
|
||||
RequestCreators.withPayload(new StringSource("<request><message>Hello</message></request>")))
|
||||
.andExpect(ResponseMatchers.payload(new StringSource("<response><code>42</code></response>")));
|
||||
.sendRequest(RequestCreators.withPayload(new StringSource("<request><message>Hello</message></request>")))
|
||||
.andExpect(ResponseMatchers.payload(new StringSource("<response><code>42</code></response>")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user