Skip to content

Commit 38f6d27

Browse files
committed
Delete dead code in tests
1 parent b774147 commit 38f6d27

File tree

2 files changed

+7
-39
lines changed

2 files changed

+7
-39
lines changed

spring-web/src/test/java/org/springframework/web/filter/OncePerRequestFilterTests.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.filter;
1718

1819
import java.io.IOException;
@@ -33,9 +34,9 @@
3334

3435
import static org.assertj.core.api.Assertions.assertThat;
3536

36-
3737
/**
3838
* Unit tests for {@link OncePerRequestFilter}.
39+
*
3940
* @author Rossen Stoyanchev
4041
* @since 5.1.9
4142
*/
@@ -132,27 +133,10 @@ private static class TestOncePerRequestFilter extends OncePerRequestFilter {
132133
private boolean didFilterNestedErrorDispatch;
133134

134135

135-
public void setShouldNotFilter(boolean shouldNotFilter) {
136-
this.shouldNotFilter = shouldNotFilter;
137-
}
138-
139-
public void setShouldNotFilterAsyncDispatch(boolean shouldNotFilterAsyncDispatch) {
140-
this.shouldNotFilterAsyncDispatch = shouldNotFilterAsyncDispatch;
141-
}
142-
143136
public void setShouldNotFilterErrorDispatch(boolean shouldNotFilterErrorDispatch) {
144137
this.shouldNotFilterErrorDispatch = shouldNotFilterErrorDispatch;
145138
}
146139

147-
148-
public boolean didFilter() {
149-
return this.didFilter;
150-
}
151-
152-
public boolean didFilterNestedErrorDispatch() {
153-
return this.didFilterNestedErrorDispatch;
154-
}
155-
156140
public void reset() {
157141
this.didFilter = false;
158142
this.didFilterNestedErrorDispatch = false;

spring-websocket/src/test/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandlerTests.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.socket.server.support;
1718

1819
import java.io.IOException;
1920
import java.util.Collections;
2021
import java.util.Map;
2122
import javax.servlet.ServletException;
2223

23-
import org.junit.Before;
2424
import org.junit.Test;
2525

2626
import org.springframework.http.server.ServerHttpRequest;
@@ -42,24 +42,17 @@
4242

4343
/**
4444
* Unit tests for {@link WebSocketHttpRequestHandler}.
45+
*
4546
* @author Rossen Stoyanchev
4647
* @since 5.1.9
4748
*/
4849
public class WebSocketHttpRequestHandlerTests {
4950

50-
private HandshakeHandler handshakeHandler;
51-
52-
private WebSocketHttpRequestHandler requestHandler;
51+
private final HandshakeHandler handshakeHandler = mock(HandshakeHandler.class);
5352

54-
private MockHttpServletResponse response;
53+
private final WebSocketHttpRequestHandler requestHandler = new WebSocketHttpRequestHandler(mock(WebSocketHandler.class), this.handshakeHandler);
5554

56-
57-
@Before
58-
public void setUp() {
59-
this.handshakeHandler = mock(HandshakeHandler.class);
60-
this.requestHandler = new WebSocketHttpRequestHandler(mock(WebSocketHandler.class), this.handshakeHandler);
61-
this.response = new MockHttpServletResponse();
62-
}
55+
private final MockHttpServletResponse response = new MockHttpServletResponse();
6356

6457

6558
@Test
@@ -105,19 +98,11 @@ private static class TestInterceptor implements HandshakeInterceptor {
10598

10699
private final boolean allowHandshake;
107100

108-
private Exception exception;
109-
110-
111101
private TestInterceptor(boolean allowHandshake) {
112102
this.allowHandshake = allowHandshake;
113103
}
114104

115105

116-
public Exception getException() {
117-
return this.exception;
118-
}
119-
120-
121106
@Override
122107
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response,
123108
WebSocketHandler wsHandler, Map<String, Object> attributes) {
@@ -131,7 +116,6 @@ public void afterHandshake(ServerHttpRequest request, ServerHttpResponse respons
131116
WebSocketHandler wsHandler, Exception exception) {
132117

133118
response.getHeaders().add("exceptionHeaderName", "exceptionHeaderValue");
134-
this.exception = exception;
135119
}
136120
}
137121

0 commit comments

Comments
 (0)