Skip to content

Commit 1ddf8ec

Browse files
committed
Polishing
1 parent 73493bc commit 1ddf8ec

File tree

7 files changed

+33
-37
lines changed

7 files changed

+33
-37
lines changed

spring-web/src/main/java/org/springframework/web/filter/ShallowEtagHeaderFilter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.io.InputStream;
2121
import java.io.PrintWriter;
22-
2322
import javax.servlet.FilterChain;
2423
import javax.servlet.ServletException;
2524
import javax.servlet.ServletOutputStream;
@@ -72,8 +71,8 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
7271
* Set whether the ETag value written to the response should be weak, as per RFC 7232.
7372
* <p>Should be configured using an {@code <init-param>} for parameter name
7473
* "writeWeakETag" in the filter definition in {@code web.xml}.
75-
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">RFC 7232 section 2.3</a>
7674
* @since 4.3
75+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">RFC 7232 section 2.3</a>
7776
*/
7877
public void setWriteWeakETag(boolean writeWeakETag) {
7978
this.writeWeakETag = writeWeakETag;
@@ -89,8 +88,8 @@ public boolean isWriteWeakETag() {
8988

9089

9190
/**
92-
* The default value is "false" so that the filter may delay the generation of
93-
* an ETag until the last asynchronously dispatched thread.
91+
* The default value is {@code false} so that the filter may delay the generation
92+
* of an ETag until the last asynchronously dispatched thread.
9493
*/
9594
@Override
9695
protected boolean shouldNotFilterAsyncDispatch() {

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonHintsIntegrationTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.util.List;
2121

2222
import com.fasterxml.jackson.annotation.JsonView;
23-
import static org.junit.Assert.assertEquals;
2423
import org.junit.Test;
2524
import reactor.core.publisher.Flux;
2625
import reactor.core.publisher.Mono;
@@ -36,6 +35,8 @@
3635
import org.springframework.web.bind.annotation.RestController;
3736
import org.springframework.web.reactive.config.EnableWebFlux;
3837

38+
import static org.junit.Assert.*;
39+
3940
/**
4041
* @author Sebastien Deleuze
4142
*/
@@ -49,6 +50,7 @@ protected ApplicationContext initApplicationContext() {
4950
return wac;
5051
}
5152

53+
5254
@Test
5355
public void jsonViewResponse() throws Exception {
5456
String expected = "{\"withView1\":\"with\"}";
@@ -98,6 +100,7 @@ public void jsonViewWithFluxRequest() throws Exception {
98100
static class WebConfig {
99101
}
100102

103+
101104
@RestController
102105
@SuppressWarnings("unused")
103106
private static class JsonViewRestController {
@@ -188,4 +191,4 @@ public void setWithoutView(String withoutView) {
188191
}
189192
}
190193

191-
}
194+
}

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingDataBindingIntegrationTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,8 +42,7 @@
4242
import org.springframework.web.bind.annotation.RestController;
4343
import org.springframework.web.reactive.config.EnableWebFlux;
4444

45-
import static org.junit.Assert.assertEquals;
46-
45+
import static org.junit.Assert.*;
4746

4847
/**
4948
* Data binding and type conversion related integration tests for
@@ -89,6 +88,7 @@ public void handleForm() throws Exception {
8988
static class WebConfig {
9089
}
9190

91+
9292
@RestController
9393
@SuppressWarnings({"unused", "OptionalUsedAsFieldOrParameterType"})
9494
private static class TestController {
@@ -120,6 +120,7 @@ public String handleForm(@ModelAttribute Foo foo, Errors errors) {
120120
}
121121
}
122122

123+
123124
private static class Foo {
124125

125126
private final Long id;

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingExceptionHandlingIntegrationTests.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,8 +31,7 @@
3131
import org.springframework.web.bind.annotation.RestController;
3232
import org.springframework.web.reactive.config.EnableWebFlux;
3333

34-
import static org.junit.Assert.assertEquals;
35-
34+
import static org.junit.Assert.*;
3635

3736
/**
3837
* {@code @RequestMapping} integration tests with exception handling scenarios.
@@ -41,7 +40,6 @@
4140
*/
4241
public class RequestMappingExceptionHandlingIntegrationTests extends AbstractRequestMappingIntegrationTests {
4342

44-
4543
@Override
4644
protected ApplicationContext initApplicationContext() {
4745
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
@@ -69,7 +67,6 @@ public void controllerReturnsMonoError() throws Exception {
6967
@ComponentScan(resourcePattern = "**/RequestMappingExceptionHandlingIntegrationTests$*.class")
7068
@SuppressWarnings({"unused", "WeakerAccess"})
7169
static class WebConfig {
72-
7370
}
7471

7572

@@ -96,7 +93,6 @@ public Publisher<String> handleArgumentException(IllegalArgumentException ex) {
9693
public ResponseEntity<Publisher<String>> handleStateException(IllegalStateException ex) {
9794
return ResponseEntity.ok(Mono.just("Recovered from error: " + ex.getMessage()));
9895
}
99-
10096
}
10197

10298
}

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,9 +31,7 @@
3131
import org.springframework.web.bind.annotation.RestController;
3232
import org.springframework.web.reactive.config.EnableWebFlux;
3333

34-
import static org.junit.Assert.assertArrayEquals;
35-
import static org.junit.Assert.assertEquals;
36-
34+
import static org.junit.Assert.*;
3735

3836
/**
3937
* Integration tests with {@code @RequestMapping} handler methods.
@@ -54,6 +52,7 @@ protected ApplicationContext initApplicationContext() {
5452
return wac;
5553
}
5654

55+
5756
@Test
5857
public void handleWithParam() throws Exception {
5958
String expected = "Hello George!";
@@ -86,6 +85,7 @@ public void objectStreamResultWithAllMediaType() throws Exception {
8685
static class WebConfig {
8786
}
8887

88+
8989
@RestController
9090
@SuppressWarnings("unused")
9191
private static class TestRestController {
@@ -104,9 +104,9 @@ public Publisher<Long> longStreamResponseBody() {
104104
public Publisher<Foo> objectStreamResponseBody() {
105105
return Flux.just(new Foo("bar"));
106106
}
107-
108107
}
109108

109+
110110
private static class Foo {
111111

112112
private String name;

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingViewResolutionIntegrationTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,10 +39,7 @@
3939
import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer;
4040
import org.springframework.web.server.ServerWebExchange;
4141

42-
import static org.junit.Assert.assertEquals;
43-
import static org.junit.Assert.assertNull;
44-
import static org.springframework.http.RequestEntity.get;
45-
42+
import static org.junit.Assert.*;
4643

4744
/**
4845
* {@code @RequestMapping} integration tests with view resolution scenarios.
@@ -51,7 +48,6 @@
5148
*/
5249
public class RequestMappingViewResolutionIntegrationTests extends AbstractRequestMappingIntegrationTests {
5350

54-
5551
@Override
5652
protected ApplicationContext initApplicationContext() {
5753
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
@@ -70,7 +66,7 @@ public void html() throws Exception {
7066
@Test
7167
public void etagCheckWithNotModifiedResponse() throws Exception {
7268
URI uri = new URI("http://localhost:" + this.port + "/html");
73-
RequestEntity<Void> request = get(uri).ifNoneMatch("\"deadb33f8badf00d\"").build();
69+
RequestEntity<Void> request = RequestEntity.get(uri).ifNoneMatch("\"deadb33f8badf00d\"").build();
7470
ResponseEntity<String> response = getRestTemplate().exchange(request, String.class);
7571

7672
assertEquals(HttpStatus.NOT_MODIFIED, response.getStatusCode());
@@ -95,9 +91,9 @@ public FreeMarkerConfigurer freeMarkerConfig() {
9591
configurer.setTemplateLoaderPath("classpath*:org/springframework/web/reactive/view/freemarker/");
9692
return configurer;
9793
}
98-
9994
}
10095

96+
10197
@Controller
10298
@SuppressWarnings("unused")
10399
private static class TestController {
@@ -112,7 +108,6 @@ public String getHtmlPage(@RequestParam Optional<String> name, Model model,
112108
model.addAttribute("hello", "Hello: " + name.orElse("<no name>") + "!");
113109
return "test";
114110
}
115-
116111
}
117112

118113
}

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolverTests.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,27 @@
5050
*/
5151
public class ServletRequestMethodArgumentResolverTests {
5252

53-
private final ServletRequestMethodArgumentResolver resolver = new ServletRequestMethodArgumentResolver();
54-
55-
private Method method;
53+
private ServletRequestMethodArgumentResolver resolver;
5654

5755
private ModelAndViewContainer mavContainer;
5856

57+
private MockHttpServletRequest servletRequest;
58+
5959
private ServletWebRequest webRequest;
6060

61-
private MockHttpServletRequest servletRequest;
61+
private Method method;
6262

6363

6464
@Before
6565
public void setup() throws Exception {
66-
method = getClass().getMethod("supportedParams", ServletRequest.class, MultipartRequest.class,
67-
HttpSession.class, Principal.class, Locale.class, InputStream.class, Reader.class,
68-
WebRequest.class, TimeZone.class, ZoneId.class, HttpMethod.class);
66+
resolver = new ServletRequestMethodArgumentResolver();
6967
mavContainer = new ModelAndViewContainer();
7068
servletRequest = new MockHttpServletRequest("GET", "");
7169
webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse());
70+
71+
method = getClass().getMethod("supportedParams", ServletRequest.class, MultipartRequest.class,
72+
HttpSession.class, Principal.class, Locale.class, InputStream.class, Reader.class,
73+
WebRequest.class, TimeZone.class, ZoneId.class, HttpMethod.class);
7274
}
7375

7476

0 commit comments

Comments
 (0)