Suppress deprecation warning for MHSR.setStatus()

Suppressing deprecation warnings for
MockHttpServletResponse.setStatus(int, String).
This commit is contained in:
Sam Brannen 2014-01-06 12:15:52 +01:00
parent 5d3484c74a
commit 27ab9332c1
2 changed files with 11 additions and 6 deletions

View File

@ -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");

View File

@ -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");