Removed tests for invalid -1 index (for compatibility with JsonPath 2.1)
This commit is contained in:
parent
9bb72e8386
commit
aef6b20626
|
|
@ -78,7 +78,6 @@ public class JsonPathRequestMatchersIntegrationTests {
|
|||
.andExpect(content().contentType("application/json;charset=UTF-8"))
|
||||
.andExpect(jsonPath("$.composers[?(@.name == 'Edvard Grieeeeeeg')]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[?(@.name == 'Robert Schuuuuuuman')]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[-1]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[4]").doesNotExist())
|
||||
.andRespond(withSuccess());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class JsonPathAssertionTests {
|
|||
|
||||
private MockMvc mockMvc;
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.mockMvc = standaloneSetup(new MusicController())
|
||||
|
|
@ -54,9 +55,9 @@ public class JsonPathAssertionTests {
|
|||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExists() throws Exception {
|
||||
|
||||
@Test
|
||||
public void exists() throws Exception {
|
||||
String composerByName = "$.composers[?(@.name == '%s')]";
|
||||
String performerByName = "$.performers[?(@.name == '%s')]";
|
||||
|
||||
|
|
@ -74,16 +75,15 @@ public class JsonPathAssertionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoesNotExist() throws Exception {
|
||||
public void doesNotExist() throws Exception {
|
||||
this.mockMvc.perform(get("/music/people"))
|
||||
.andExpect(jsonPath("$.composers[?(@.name == 'Edvard Grieeeeeeg')]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[?(@.name == 'Robert Schuuuuuuman')]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[-1]").doesNotExist())
|
||||
.andExpect(jsonPath("$.composers[4]").doesNotExist());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualTo() throws Exception {
|
||||
public void equality() throws Exception {
|
||||
this.mockMvc.perform(get("/music/people"))
|
||||
.andExpect(jsonPath("$.composers[0].name").value("Johann Sebastian Bach"))
|
||||
.andExpect(jsonPath("$.performers[1].name").value("Yehudi Menuhin"));
|
||||
|
|
@ -95,7 +95,7 @@ public class JsonPathAssertionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHamcrestMatcher() throws Exception {
|
||||
public void hamcrestMatcher() throws Exception {
|
||||
this.mockMvc.perform(get("/music/people"))
|
||||
.andExpect(jsonPath("$.composers[0].name", startsWith("Johann")))
|
||||
.andExpect(jsonPath("$.performers[0].name", endsWith("Ashkenazy")))
|
||||
|
|
@ -104,8 +104,7 @@ public class JsonPathAssertionTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHamcrestMatcherWithParameterizedJsonPath() throws Exception {
|
||||
|
||||
public void hamcrestMatcherWithParameterizedJsonPath() throws Exception {
|
||||
String composerName = "$.composers[%s].name";
|
||||
String performerName = "$.performers[%s].name";
|
||||
|
||||
|
|
@ -135,4 +134,5 @@ public class JsonPathAssertionTests {
|
|||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue