Clean up regarding deprecated HttpStatus.MOVED_TEMPORARILY

This commit is contained in:
Sam Brannen 2014-08-14 00:29:09 +02:00
parent 3e2138855a
commit 2cbd5ba993
4 changed files with 9 additions and 7 deletions

View File

@ -283,6 +283,7 @@ public class StatusResultMatchers {
/** /**
* Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302). * Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302).
* @see #isFound() * @see #isFound()
* @deprecated in favor of {@link #isFound()}
*/ */
@Deprecated @Deprecated
public ResultMatcher isMovedTemporarily() { public ResultMatcher isMovedTemporarily() {

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"); you may not use this file except in compliance with * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
@ -10,6 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License. * specific language governing permissions and limitations under the License.
*/ */
package org.springframework.test.web.servlet.samples.standalone; package org.springframework.test.web.servlet.samples.standalone;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
@ -53,7 +54,7 @@ public class FilterTests {
standaloneSetup(new PersonController()) standaloneSetup(new PersonController())
.addFilters(new ContinueFilter()).build() .addFilters(new ContinueFilter()).build()
.perform(post("/persons").param("name", "Andy")) .perform(post("/persons").param("name", "Andy"))
.andExpect(status().isMovedTemporarily()) .andExpect(status().isFound())
.andExpect(redirectedUrl("/person/1")) .andExpect(redirectedUrl("/person/1"))
.andExpect(model().size(1)) .andExpect(model().size(1))
.andExpect(model().attributeExists("id")) .andExpect(model().attributeExists("id"))
@ -90,7 +91,7 @@ public class FilterTests {
standaloneSetup(new PersonController()) standaloneSetup(new PersonController())
.addFilter(new RedirectFilter(), "/p", "/person").build() .addFilter(new RedirectFilter(), "/p", "/person").build()
.perform(post("/persons").param("name", "Andy")) .perform(post("/persons").param("name", "Andy"))
.andExpect(status().isMovedTemporarily()) .andExpect(status().isFound())
.andExpect(redirectedUrl("/person/1")) .andExpect(redirectedUrl("/person/1"))
.andExpect(model().size(1)) .andExpect(model().size(1))
.andExpect(model().attributeExists("id")) .andExpect(model().attributeExists("id"))

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.
@ -51,7 +51,7 @@ public class RedirectTests {
@Test @Test
public void save() throws Exception { public void save() throws Exception {
this.mockMvc.perform(post("/persons").param("name", "Andy")) this.mockMvc.perform(post("/persons").param("name", "Andy"))
.andExpect(status().isMovedTemporarily()) .andExpect(status().isFound())
.andExpect(redirectedUrl("/persons/Joe")) .andExpect(redirectedUrl("/persons/Joe"))
.andExpect(model().size(1)) .andExpect(model().size(1))
.andExpect(model().attributeExists("name")) .andExpect(model().attributeExists("name"))

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.
@ -48,7 +48,7 @@ public class FlashAttributeAssertionTests {
@Before @Before
public void setup() { public void setup() {
this.mockMvc = standaloneSetup(new PersonController()) this.mockMvc = standaloneSetup(new PersonController())
.alwaysExpect(status().isMovedTemporarily()) .alwaysExpect(status().isFound())
.alwaysExpect(flash().attributeCount(3)) .alwaysExpect(flash().attributeCount(3))
.build(); .build();
} }