Delete dead code in tests

master
Sam Brannen 5 years ago
parent b774147db4
commit 38f6d270f8
  1. 20
      spring-web/src/test/java/org/springframework/web/filter/OncePerRequestFilterTests.java
  2. 26
      spring-websocket/src/test/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandlerTests.java

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.filter; package org.springframework.web.filter;
import java.io.IOException; import java.io.IOException;
@ -33,9 +34,9 @@ import org.springframework.web.util.WebUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Unit tests for {@link OncePerRequestFilter}. * Unit tests for {@link OncePerRequestFilter}.
*
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.1.9 * @since 5.1.9
*/ */
@ -132,27 +133,10 @@ public class OncePerRequestFilterTests {
private boolean didFilterNestedErrorDispatch; private boolean didFilterNestedErrorDispatch;
public void setShouldNotFilter(boolean shouldNotFilter) {
this.shouldNotFilter = shouldNotFilter;
}
public void setShouldNotFilterAsyncDispatch(boolean shouldNotFilterAsyncDispatch) {
this.shouldNotFilterAsyncDispatch = shouldNotFilterAsyncDispatch;
}
public void setShouldNotFilterErrorDispatch(boolean shouldNotFilterErrorDispatch) { public void setShouldNotFilterErrorDispatch(boolean shouldNotFilterErrorDispatch) {
this.shouldNotFilterErrorDispatch = shouldNotFilterErrorDispatch; this.shouldNotFilterErrorDispatch = shouldNotFilterErrorDispatch;
} }
public boolean didFilter() {
return this.didFilter;
}
public boolean didFilterNestedErrorDispatch() {
return this.didFilterNestedErrorDispatch;
}
public void reset() { public void reset() {
this.didFilter = false; this.didFilter = false;
this.didFilterNestedErrorDispatch = false; this.didFilterNestedErrorDispatch = false;

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.server.support; package org.springframework.web.socket.server.support;
import java.io.IOException; import java.io.IOException;
@ -20,7 +21,6 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpRequest;
@ -42,24 +42,17 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
/** /**
* Unit tests for {@link WebSocketHttpRequestHandler}. * Unit tests for {@link WebSocketHttpRequestHandler}.
*
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.1.9 * @since 5.1.9
*/ */
public class WebSocketHttpRequestHandlerTests { public class WebSocketHttpRequestHandlerTests {
private HandshakeHandler handshakeHandler; private final HandshakeHandler handshakeHandler = mock(HandshakeHandler.class);
private WebSocketHttpRequestHandler requestHandler;
private MockHttpServletResponse response; private final WebSocketHttpRequestHandler requestHandler = new WebSocketHttpRequestHandler(mock(WebSocketHandler.class), this.handshakeHandler);
private final MockHttpServletResponse response = new MockHttpServletResponse();
@Before
public void setUp() {
this.handshakeHandler = mock(HandshakeHandler.class);
this.requestHandler = new WebSocketHttpRequestHandler(mock(WebSocketHandler.class), this.handshakeHandler);
this.response = new MockHttpServletResponse();
}
@Test @Test
@ -105,19 +98,11 @@ public class WebSocketHttpRequestHandlerTests {
private final boolean allowHandshake; private final boolean allowHandshake;
private Exception exception;
private TestInterceptor(boolean allowHandshake) { private TestInterceptor(boolean allowHandshake) {
this.allowHandshake = allowHandshake; this.allowHandshake = allowHandshake;
} }
public Exception getException() {
return this.exception;
}
@Override @Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response,
WebSocketHandler wsHandler, Map<String, Object> attributes) { WebSocketHandler wsHandler, Map<String, Object> attributes) {
@ -131,7 +116,6 @@ public class WebSocketHttpRequestHandlerTests {
WebSocketHandler wsHandler, Exception exception) { WebSocketHandler wsHandler, Exception exception) {
response.getHeaders().add("exceptionHeaderName", "exceptionHeaderValue"); response.getHeaders().add("exceptionHeaderName", "exceptionHeaderValue");
this.exception = exception;
} }
} }

Loading…
Cancel
Save