Skip to content

Commit f0f450a

Browse files
committed
Polishing
1 parent f854803 commit f0f450a

File tree

6 files changed

+19
-25
lines changed

6 files changed

+19
-25
lines changed

spring-beans/src/test/java/org/springframework/beans/factory/config/YamlProcessorTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ void flattenedMapIsSameAsPropertiesButOrdered() {
141141
}
142142

143143
@Test
144+
@SuppressWarnings("unchecked")
144145
void standardTypesSupportedByDefault() throws Exception {
145146
setYaml("value: !!set\n ? first\n ? second");
146147
this.processor.process((properties, map) -> {

spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ private MessageProducer getCachedProducer(@Nullable Destination dest) throws JMS
423423
return new CachedMessageProducer(producer);
424424
}
425425

426+
@SuppressWarnings("resource")
426427
private MessageConsumer getCachedConsumer(Destination dest, @Nullable String selector,
427428
@Nullable Boolean noLocal, @Nullable String subscription, boolean durable) throws JMSException {
428429

spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/Jetty10WebSocketHandlerAdapter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@
4848
@WebSocket
4949
public class Jetty10WebSocketHandlerAdapter {
5050

51-
private static final ByteBuffer EMPTY_PAYLOAD = ByteBuffer.wrap(new byte[0]);
52-
53-
5451
private final WebSocketHandler delegateHandler;
5552

5653
private final Function<Session, JettyWebSocketSession> sessionFactory;
@@ -97,7 +94,9 @@ public void onWebSocketBinary(byte[] message, int offset, int length) {
9794
// TODO: onWebSocketFrame can't be declared without compiling against Jetty 10
9895
// Jetty 10: org.eclipse.jetty.websocket.api.Frame
9996
// Jetty 9: org.eclipse.jetty.websocket.api.extensions.Frame
100-
97+
//
98+
// private static final ByteBuffer EMPTY_PAYLOAD = ByteBuffer.wrap(new byte[0]);
99+
//
101100
// @OnWebSocketFrame
102101
// public void onWebSocketFrame(Frame frame) {
103102
// if (this.delegateSession != null) {

spring-webmvc/src/test/java/org/springframework/web/servlet/function/SseServerResponseTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -90,8 +90,7 @@ void sendObject() throws Exception {
9090
}
9191

9292
@Test
93-
public void builder() throws Exception {
94-
String body = "foo bar";
93+
void builder() throws Exception {
9594
ServerResponse response = ServerResponse.sse(sse -> {
9695
try {
9796
sse.id("id")
@@ -132,14 +131,15 @@ public Person(String name, int age) {
132131
this.age = age;
133132
}
134133

134+
@SuppressWarnings("unused")
135135
public String getName() {
136136
return this.name;
137137
}
138138

139+
@SuppressWarnings("unused")
139140
public int getAge() {
140141
return this.age;
141142
}
142143
}
143144

144-
145145
}

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -30,7 +30,6 @@
3030

3131
import org.springframework.core.MethodParameter;
3232
import org.springframework.web.context.request.ServletWebRequest;
33-
import org.springframework.web.method.support.ModelAndViewContainer;
3433
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
3534
import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
3635

@@ -41,32 +40,25 @@
4140
*
4241
* @author Rossen Stoyanchev
4342
*/
44-
public class PrincipalMethodArgumentResolverTests {
43+
class PrincipalMethodArgumentResolverTests {
4544

46-
private PrincipalMethodArgumentResolver resolver;
45+
private PrincipalMethodArgumentResolver resolver = new PrincipalMethodArgumentResolver();
4746

48-
private ModelAndViewContainer mavContainer;
47+
private MockHttpServletRequest servletRequest = new MockHttpServletRequest("GET", "");
4948

50-
private MockHttpServletRequest servletRequest;
51-
52-
private ServletWebRequest webRequest;
49+
private ServletWebRequest webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse());
5350

5451
private Method method;
5552

5653

5754
@BeforeEach
58-
public void setup() throws Exception {
59-
resolver = new PrincipalMethodArgumentResolver();
60-
mavContainer = new ModelAndViewContainer();
61-
servletRequest = new MockHttpServletRequest("GET", "");
62-
webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse());
63-
55+
void setup() throws Exception {
6456
method = getClass().getMethod("supportedParams", ServletRequest.class, Principal.class);
6557
}
6658

6759

6860
@Test
69-
public void principal() throws Exception {
61+
void principal() throws Exception {
7062
Principal principal = () -> "Foo";
7163
servletRequest.setUserPrincipal(principal);
7264

@@ -78,7 +70,7 @@ public void principal() throws Exception {
7870
}
7971

8072
@Test
81-
public void principalAsNull() throws Exception {
73+
void principalAsNull() throws Exception {
8274
MethodParameter principalParameter = new MethodParameter(method, 1);
8375
assertThat(resolver.supportsParameter(principalParameter)).as("Principal not supported").isTrue();
8476

@@ -87,7 +79,7 @@ public void principalAsNull() throws Exception {
8779
}
8880

8981
@Test // gh-25780
90-
public void annotatedPrincipal() throws Exception {
82+
void annotatedPrincipal() throws Exception {
9183
Principal principal = () -> "Foo";
9284
servletRequest.setUserPrincipal(principal);
9385
Method principalMethod = getClass().getMethod("supportedParamsWithAnnotatedPrincipal", Principal.class);

spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceUrlProviderTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ void initializeOnce() throws Exception {
151151
}
152152

153153
@Test
154+
@SuppressWarnings("resource")
154155
void initializeOnCurrentContext() {
155156
AnnotationConfigWebApplicationContext parentContext = new AnnotationConfigWebApplicationContext();
156157
parentContext.setServletContext(new MockServletContext());

0 commit comments

Comments
 (0)