Rename doesExist() to exists() for header assertions
This commit is contained in:
@@ -126,16 +126,16 @@ public class HeaderAssertionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesExist() {
|
||||
public void exists() {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
HeaderAssertions assertions = headerAssertions(headers);
|
||||
|
||||
// Success
|
||||
assertions.doesExist("Content-Type");
|
||||
assertions.exists("Content-Type");
|
||||
|
||||
try {
|
||||
assertions.doesExist("Framework");
|
||||
assertions.exists("Framework");
|
||||
fail("Header should not exist");
|
||||
}
|
||||
catch (AssertionError error) {
|
||||
|
||||
@@ -144,6 +144,16 @@ public class HeaderAssertionTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exists() throws Exception {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().exists(LAST_MODIFIED));
|
||||
}
|
||||
|
||||
@Test(expected = AssertionError.class)
|
||||
public void existsFail() throws Exception {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().exists("X-Custom-Header"));
|
||||
}
|
||||
|
||||
@Test // SPR-10771
|
||||
public void doesNotExist() throws Exception {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().doesNotExist("X-Custom-Header"));
|
||||
@@ -154,16 +164,6 @@ public class HeaderAssertionTests {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().doesNotExist(LAST_MODIFIED));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesExist() throws Exception {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().doesExist(LAST_MODIFIED));
|
||||
}
|
||||
|
||||
@Test(expected = AssertionError.class)
|
||||
public void doesExistFail() throws Exception {
|
||||
this.mockMvc.perform(get("/persons/1")).andExpect(header().doesExist("X-Custom-Header"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringWithIncorrectResponseHeaderValue() throws Exception {
|
||||
assertIncorrectResponseHeader(header().string(LAST_MODIFIED, secondLater), secondLater);
|
||||
|
||||
Reference in New Issue
Block a user