Browse Source

Merge branch '2.2.x' into 2.3.x

Closes gh-22576
pull/22996/head
Andy Wilkinson 6 years ago
parent
commit
5279b90ced
  1. 9
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilter.java
  2. 9
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilter.java
  3. 12
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java
  4. 12
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java

9
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -21,6 +21,8 @@ import java.util.Collections; @@ -21,6 +21,8 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import com.fasterxml.jackson.databind.Module;
import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.boot.jackson.JsonComponent;
import org.springframework.boot.test.autoconfigure.filter.StandardAnnotationCustomizableTypeExcludeFilter;
@ -54,6 +56,11 @@ public final class WebFluxTypeExcludeFilter extends StandardAnnotationCustomizab @@ -54,6 +56,11 @@ public final class WebFluxTypeExcludeFilter extends StandardAnnotationCustomizab
includes.add(GenericConverter.class);
includes.add(WebExceptionHandler.class);
includes.add(WebFilter.class);
try {
includes.add(Module.class);
}
catch (Throwable ex) {
}
DEFAULT_INCLUDES = Collections.unmodifiableSet(includes);
}

9
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -21,6 +21,8 @@ import java.util.Collections; @@ -21,6 +21,8 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import com.fasterxml.jackson.databind.Module;
import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.boot.jackson.JsonComponent;
import org.springframework.boot.test.autoconfigure.filter.StandardAnnotationCustomizableTypeExcludeFilter;
@ -68,6 +70,11 @@ public final class WebMvcTypeExcludeFilter extends StandardAnnotationCustomizabl @@ -68,6 +70,11 @@ public final class WebMvcTypeExcludeFilter extends StandardAnnotationCustomizabl
includes.add(Converter.class);
includes.add(GenericConverter.class);
includes.add(HandlerInterceptor.class);
try {
includes.add(Module.class);
}
catch (Throwable ex) {
}
for (String optionalInclude : OPTIONAL_INCLUDES) {
try {
includes.add(ClassUtils.forName(optionalInclude, null));

12
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTypeExcludeFilterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -18,6 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.reactive; @@ -18,6 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.reactive;
import java.io.IOException;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
@ -57,6 +58,7 @@ class WebFluxTypeExcludeFilterTests { @@ -57,6 +58,7 @@ class WebFluxTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebFilter.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -69,6 +71,7 @@ class WebFluxTypeExcludeFilterTests { @@ -69,6 +71,7 @@ class WebFluxTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebFilter.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -81,6 +84,7 @@ class WebFluxTypeExcludeFilterTests { @@ -81,6 +84,7 @@ class WebFluxTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebFilter.class)).isTrue();
assertThat(excludes(filter, ExampleModule.class)).isTrue();
}
@Test
@ -93,6 +97,7 @@ class WebFluxTypeExcludeFilterTests { @@ -93,6 +97,7 @@ class WebFluxTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isFalse();
assertThat(excludes(filter, ExampleWebFilter.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -105,6 +110,7 @@ class WebFluxTypeExcludeFilterTests { @@ -105,6 +110,7 @@ class WebFluxTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebFilter.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
private boolean excludes(WebFluxTypeExcludeFilter filter, Class<?> type) throws IOException {
@ -175,4 +181,8 @@ class WebFluxTypeExcludeFilterTests { @@ -175,4 +181,8 @@ class WebFluxTypeExcludeFilterTests {
}
static class ExampleModule extends SimpleModule {
}
}

12
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -18,6 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.servlet; @@ -18,6 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.servlet;
import java.io.IOException;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.ComponentScan.Filter;
@ -57,6 +58,7 @@ class WebMvcTypeExcludeFilterTests { @@ -57,6 +58,7 @@ class WebMvcTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebSecurityConfigurer.class)).isFalse();
assertThat(excludes(filter, ExampleHandlerInterceptor.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -71,6 +73,7 @@ class WebMvcTypeExcludeFilterTests { @@ -71,6 +73,7 @@ class WebMvcTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebSecurityConfigurer.class)).isFalse();
assertThat(excludes(filter, ExampleHandlerInterceptor.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -85,6 +88,7 @@ class WebMvcTypeExcludeFilterTests { @@ -85,6 +88,7 @@ class WebMvcTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebSecurityConfigurer.class)).isTrue();
assertThat(excludes(filter, ExampleHandlerInterceptor.class)).isTrue();
assertThat(excludes(filter, ExampleModule.class)).isTrue();
}
@Test
@ -98,6 +102,7 @@ class WebMvcTypeExcludeFilterTests { @@ -98,6 +102,7 @@ class WebMvcTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleService.class)).isTrue();
assertThat(excludes(filter, ExampleRepository.class)).isFalse();
assertThat(excludes(filter, ExampleHandlerInterceptor.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
@Test
@ -112,6 +117,7 @@ class WebMvcTypeExcludeFilterTests { @@ -112,6 +117,7 @@ class WebMvcTypeExcludeFilterTests {
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
assertThat(excludes(filter, ExampleWebSecurityConfigurer.class)).isFalse();
assertThat(excludes(filter, ExampleHandlerInterceptor.class)).isFalse();
assertThat(excludes(filter, ExampleModule.class)).isFalse();
}
private boolean excludes(WebMvcTypeExcludeFilter filter, Class<?> type) throws IOException {
@ -185,4 +191,8 @@ class WebMvcTypeExcludeFilterTests { @@ -185,4 +191,8 @@ class WebMvcTypeExcludeFilterTests {
}
static class ExampleModule extends SimpleModule {
}
}

Loading…
Cancel
Save