Browse Source

Suppress deprecation warning for MHSR.setStatus()

Suppressing deprecation warnings for
MockHttpServletResponse.setStatus(int, String).
pull/432/merge
Sam Brannen 11 years ago
parent
commit
27ab9332c1
  1. 14
      spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java
  2. 3
      spring-test/src/test/java/org/springframework/test/web/servlet/result/PrintingResultHandlerTests.java

14
spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.junit.Test; import org.junit.Test;
@ -221,8 +222,9 @@ public class MockHttpServletResponseTests {
assertEquals(redirectUrl, response.getRedirectedUrl()); assertEquals(redirectUrl, response.getRedirectedUrl());
} }
// SPR-10414 /**
* SPR-10414
*/
@Test @Test
public void modifyStatusAfterSendError() throws IOException { public void modifyStatusAfterSendError() throws IOException {
response.sendError(HttpServletResponse.SC_NOT_FOUND); response.sendError(HttpServletResponse.SC_NOT_FOUND);
@ -230,9 +232,11 @@ public class MockHttpServletResponseTests {
assertEquals(response.getStatus(),HttpServletResponse.SC_NOT_FOUND); assertEquals(response.getStatus(),HttpServletResponse.SC_NOT_FOUND);
} }
// SPR-10414 /**
* SPR-10414
*/
@Test @Test
@SuppressWarnings("deprecation")
public void modifyStatusMessageAfterSendError() throws IOException { public void modifyStatusMessageAfterSendError() throws IOException {
response.sendError(HttpServletResponse.SC_NOT_FOUND); response.sendError(HttpServletResponse.SC_NOT_FOUND);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,"Server Error"); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,"Server Error");

3
spring-test/src/test/java/org/springframework/test/web/servlet/result/PrintingResultHandlerTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -92,6 +92,7 @@ public class PrintingResultHandlerTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
public void testPrintResponse() throws Exception { public void testPrintResponse() throws Exception {
this.response.setStatus(400, "error"); this.response.setStatus(400, "error");
this.response.addHeader("header", "headerValue"); this.response.addHeader("header", "headerValue");

Loading…
Cancel
Save