parent
dce8036757
commit
19ed439e4b
|
@ -34,7 +34,8 @@ import static org.hamcrest.Matchers.containsString;
|
|||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hamcrest.Matchers.isIn;
|
||||
import static org.hamcrest.Matchers.in;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
|
||||
import static org.springframework.test.web.client.match.MockRestRequestMatchers.jsonPath;
|
||||
|
@ -115,7 +116,7 @@ public class JsonPathRequestMatchersIntegrationTests {
|
|||
.andExpect(jsonPath("$.composers[0].name", startsWith("Johann")))
|
||||
.andExpect(jsonPath("$.performers[0].name", endsWith("Ashkenazy")))
|
||||
.andExpect(jsonPath("$.performers[1].name", containsString("di Me")))
|
||||
.andExpect(jsonPath("$.composers[1].name", isIn(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms"))))
|
||||
.andExpect(jsonPath("$.composers[1].name", is(in(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms")))))
|
||||
.andExpect(jsonPath("$.composers[:3].name", hasItem("Johannes Brahms")))
|
||||
.andRespond(withSuccess());
|
||||
|
||||
|
@ -132,7 +133,7 @@ public class JsonPathRequestMatchersIntegrationTests {
|
|||
.andExpect(jsonPath(composerName, 0).value(startsWith("Johann")))
|
||||
.andExpect(jsonPath(performerName, 0).value(endsWith("Ashkenazy")))
|
||||
.andExpect(jsonPath(performerName, 1).value(containsString("di Me")))
|
||||
.andExpect(jsonPath(composerName, 1).value(isIn(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms"))))
|
||||
.andExpect(jsonPath(composerName, 1).value(is(in(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms")))))
|
||||
.andRespond(withSuccess());
|
||||
|
||||
executeAndVerify();
|
||||
|
|
|
@ -32,7 +32,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.isIn;
|
||||
import static org.hamcrest.Matchers.in;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
|
@ -106,7 +107,7 @@ public class JsonPathAssertionTests {
|
|||
.andExpect(jsonPath("$.composers[0].name", startsWith("Johann")))
|
||||
.andExpect(jsonPath("$.performers[0].name", endsWith("Ashkenazy")))
|
||||
.andExpect(jsonPath("$.performers[1].name", containsString("di Me")))
|
||||
.andExpect(jsonPath("$.composers[1].name", isIn(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms"))));
|
||||
.andExpect(jsonPath("$.composers[1].name", is(in(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -118,7 +119,7 @@ public class JsonPathAssertionTests {
|
|||
.andExpect(jsonPath(composerName, 0).value(startsWith("Johann")))
|
||||
.andExpect(jsonPath(performerName, 0).value(endsWith("Ashkenazy")))
|
||||
.andExpect(jsonPath(performerName, 1).value(containsString("di Me")))
|
||||
.andExpect(jsonPath(composerName, 1).value(isIn(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms"))));
|
||||
.andExpect(jsonPath(composerName, 1).value(is(in(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms")))));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue