Polishing and completing contribution
See gh-24866
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -77,7 +77,7 @@ public class DelegatingWebFluxConfigurationTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerMapping() throws Exception {
|
||||
public void requestMappingHandlerMapping() {
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
|
||||
delegatingConfig.requestMappingHandlerMapping(delegatingConfig.webFluxContentTypeResolver());
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DelegatingWebFluxConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerAdapter() throws Exception {
|
||||
public void requestMappingHandlerAdapter() {
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
|
||||
ReactiveAdapterRegistry reactiveAdapterRegistry = delegatingConfig.webFluxAdapterRegistry();
|
||||
ServerCodecConfigurer serverCodecConfigurer = delegatingConfig.serverCodecConfigurer();
|
||||
@@ -108,11 +108,11 @@ public class DelegatingWebFluxConfigurationTests {
|
||||
boolean condition = initializer.getValidator() instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(initializer.getConversionService()).isSameAs(formatterRegistry.getValue());
|
||||
assertThat(codecsConfigurer.getValue().getReaders().size()).isEqualTo(13);
|
||||
assertThat(codecsConfigurer.getValue().getReaders().size()).isEqualTo(14);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceHandlerMapping() throws Exception {
|
||||
public void resourceHandlerMapping() {
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
|
||||
willAnswer(invocation -> {
|
||||
ResourceHandlerRegistry registry = invocation.getArgument(0);
|
||||
@@ -126,7 +126,7 @@ public class DelegatingWebFluxConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void responseBodyResultHandler() throws Exception {
|
||||
public void responseBodyResultHandler() {
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
|
||||
delegatingConfig.responseBodyResultHandler(
|
||||
delegatingConfig.webFluxAdapterRegistry(),
|
||||
@@ -138,7 +138,7 @@ public class DelegatingWebFluxConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void viewResolutionResultHandler() throws Exception {
|
||||
public void viewResolutionResultHandler() {
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
|
||||
delegatingConfig.viewResolutionResultHandler(delegatingConfig.webFluxAdapterRegistry(),
|
||||
delegatingConfig.webFluxContentTypeResolver());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -97,7 +97,7 @@ import static org.springframework.web.testfixture.http.server.reactive.MockServe
|
||||
public class WebFluxConfigurationSupportTests {
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerMapping() throws Exception {
|
||||
public void requestMappingHandlerMapping() {
|
||||
ApplicationContext context = loadConfig(WebFluxConfig.class);
|
||||
final Field field = ReflectionUtils.findField(PathPatternParser.class, "matchOptionalTrailingSeparator");
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
@@ -118,7 +118,8 @@ public class WebFluxConfigurationSupportTests {
|
||||
assertThat(mapping.getContentTypeResolver()).isSameAs(resolver);
|
||||
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(get("/path").accept(MediaType.APPLICATION_JSON));
|
||||
assertThat(resolver.resolveMediaTypes(exchange)).isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
assertThat(resolver.resolveMediaTypes(exchange))
|
||||
.isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -138,11 +139,12 @@ public class WebFluxConfigurationSupportTests {
|
||||
|
||||
Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
|
||||
assertThat(map.size()).isEqualTo(1);
|
||||
assertThat(map.keySet().iterator().next().getPatternsCondition().getPatterns()).isEqualTo(Collections.singleton(new PathPatternParser().parse("/api/user/{id}")));
|
||||
assertThat(map.keySet().iterator().next().getPatternsCondition().getPatterns())
|
||||
.isEqualTo(Collections.singleton(new PathPatternParser().parse("/api/user/{id}")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerAdapter() throws Exception {
|
||||
public void requestMappingHandlerAdapter() {
|
||||
ApplicationContext context = loadConfig(WebFluxConfig.class);
|
||||
|
||||
String name = "requestMappingHandlerAdapter";
|
||||
@@ -150,7 +152,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
assertThat(adapter).isNotNull();
|
||||
|
||||
List<HttpMessageReader<?>> readers = adapter.getMessageReaders();
|
||||
assertThat(readers.size()).isEqualTo(13);
|
||||
assertThat(readers.size()).isEqualTo(14);
|
||||
|
||||
ResolvableType multiValueMapType = forClassWithGenerics(MultiValueMap.class, String.class, String.class);
|
||||
|
||||
@@ -180,7 +182,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customMessageConverterConfig() throws Exception {
|
||||
public void customMessageConverterConfig() {
|
||||
ApplicationContext context = loadConfig(CustomMessageConverterConfig.class);
|
||||
|
||||
String name = "requestMappingHandlerAdapter";
|
||||
@@ -195,7 +197,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void responseEntityResultHandler() throws Exception {
|
||||
public void responseEntityResultHandler() {
|
||||
ApplicationContext context = loadConfig(WebFluxConfig.class);
|
||||
|
||||
String name = "responseEntityResultHandler";
|
||||
@@ -205,7 +207,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
assertThat(handler.getOrder()).isEqualTo(0);
|
||||
|
||||
List<HttpMessageWriter<?>> writers = handler.getMessageWriters();
|
||||
assertThat(writers.size()).isEqualTo(11);
|
||||
assertThat(writers.size()).isEqualTo(12);
|
||||
|
||||
assertHasMessageWriter(writers, forClass(byte[].class), APPLICATION_OCTET_STREAM);
|
||||
assertHasMessageWriter(writers, forClass(ByteBuffer.class), APPLICATION_OCTET_STREAM);
|
||||
@@ -223,7 +225,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void responseBodyResultHandler() throws Exception {
|
||||
public void responseBodyResultHandler() {
|
||||
ApplicationContext context = loadConfig(WebFluxConfig.class);
|
||||
|
||||
String name = "responseBodyResultHandler";
|
||||
@@ -233,7 +235,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
assertThat(handler.getOrder()).isEqualTo(100);
|
||||
|
||||
List<HttpMessageWriter<?>> writers = handler.getMessageWriters();
|
||||
assertThat(writers.size()).isEqualTo(11);
|
||||
assertThat(writers.size()).isEqualTo(12);
|
||||
|
||||
assertHasMessageWriter(writers, forClass(byte[].class), APPLICATION_OCTET_STREAM);
|
||||
assertHasMessageWriter(writers, forClass(ByteBuffer.class), APPLICATION_OCTET_STREAM);
|
||||
@@ -251,7 +253,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void viewResolutionResultHandler() throws Exception {
|
||||
public void viewResolutionResultHandler() {
|
||||
ApplicationContext context = loadConfig(CustomViewResolverConfig.class);
|
||||
|
||||
String name = "viewResolutionResultHandler";
|
||||
@@ -272,7 +274,7 @@ public class WebFluxConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceHandler() throws Exception {
|
||||
public void resourceHandler() {
|
||||
ApplicationContext context = loadConfig(CustomResourceHandlingConfig.class);
|
||||
|
||||
String name = "resourceHandlerMapping";
|
||||
|
||||
Reference in New Issue
Block a user