You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
In exercise 4, part 2, I changed the AdvertisementControllerTest.readAll() test a little bit:
@Test
public void readAll() throws Exception {
// I changed this block to create 15 ads instead of just 1
final int adCount = 15;
for (int i = 0; i < adCount; i++) {
mockMvc.perform(buildPostRequest(SOME_TITLE + "i"))
.andExpect(status().isCreated());
}
mockMvc.perform(buildGetRequest(""))
.andExpect(status().isOk())
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.length()", is(both(greaterThan(0)).and(lessThan(10)))));
}
Given that I'm creating 15 ads, I was expecting the test to fail, but it didn't.
It seems that the JSON path verification line should be changed from:
In exercise 4, part 2, I changed the
AdvertisementControllerTest.readAll()
test a little bit:Given that I'm creating 15 ads, I was expecting the test to fail, but it didn't.
It seems that the JSON path verification line should be changed from:
to:
to count the number of elements of the
value
field in response JSON object.The text was updated successfully, but these errors were encountered: