This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testPutOffer() throws Exception { | |
ArrayList<Offer> offers = (ArrayList<Offer>) offersService.findAll(); | |
Offer offerToChange = offers.get(4); | |
offerToChange.setStartingPoint("München"); | |
offerToChange.setDestination("Frankfurt"); | |
offerToChange.setPrice(100); | |
offerToChange.setUsername("admin"); | |
offerToChange.setDate("2017-11-11T09:25"); | |
String json = mapper.writeValueAsString(offerToChange); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testGetOffers() throws Exception { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testGetOffers() throws Exception { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testGetOffers() throws Exception { | |
MvcResult result = mockMvc.perform(get("/api/offers")).andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(jsonPath("$", hasSize(5))) | |
.andReturn(); | |
Offer[] offers = mapper.readValue(result.getResponse().getContentAsString(), Offer[].class); | |
assertEquals(offers[0], offer1); | |
assertEquals(offers[1], offer2); | |
assertEquals(offers[2], offer3); | |
assertEquals(offers[3], offer4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Offer[] offers = mapper.readValue(result.getResponse().getContentAsString(), Offer[].class); | |
assertEquals(offers[0], offer1); | |
assertEquals(offers[1], offer2); | |
assertEquals(offers[2], offer3); | |
assertEquals(offers[3], offer4); | |
assertEquals(offers[4], offer5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MvcResult result = mockMvc.perform(get("/api/offers")).andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) | |
.andExpect(jsonPath("$", hasSize(5))) | |
.andReturn(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")) | |
.andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) | |
.andExpect(jsonPath("$", hasSize(5))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")) | |
.andExpect(status().isOk()) | |
andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) | |
.andExpect(jsonPath("$", hasSize(5))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")) | |
.andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) | |
.andExpect(jsonPath("$", hasSize(5))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")) | |
.andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) | |
.andExpect(jsonPath("$", hasSize(5))). |