|
|
|
|
@ -34,7 +34,8 @@ import static org.hamcrest.Matchers.containsString;
@@ -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 {
@@ -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 {
@@ -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(); |
|
|
|
|
|