From: Gustavo Martin Morcuende Date: Sun, 3 Jan 2016 00:17:13 +0000 (+0100) Subject: Spring REST: integration tests X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=1e83f38b0e2d04791e821ffd24bee9392cb6a034;p=JavaForFun Spring REST: integration tests --- diff --git a/SpringJava/REST/src/test/java/de/spring/webservices/rest/CarControllerIntegrationTest.java b/SpringJava/REST/src/test/java/de/spring/webservices/rest/CarControllerIntegrationTest.java index a19ecc3..3ed613c 100644 --- a/SpringJava/REST/src/test/java/de/spring/webservices/rest/CarControllerIntegrationTest.java +++ b/SpringJava/REST/src/test/java/de/spring/webservices/rest/CarControllerIntegrationTest.java @@ -50,16 +50,16 @@ public class CarControllerIntegrationTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); } -// @Test -// public void testWhenGetOneCarThenRetrieveJsonValue() throws Exception { -// mockMvc.perform(get("/api/cars/{id}", 1L) -// .accept(MediaType.APPLICATION_JSON_UTF8_VALUE)) -// -// .andExpect(status().isOk()) -// .andExpect(jsonPath("id", any(Integer.class))) -// .andExpect(jsonPath("content", is("Car: 1"))) -// .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); -// } + @Test + public void testWhenGetOneCarThenRetrieveJsonValue() throws Exception { + mockMvc.perform(get("/api/cars/{id}", 1L) + .accept(MediaType.APPLICATION_JSON_UTF8_VALUE)) + + .andExpect(status().isOk()) + .andExpect(jsonPath("id", any(Integer.class))) + .andExpect(jsonPath("content", is("Car: 1"))) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + } @Test public void testWhenCreateNewCarThenRetrieveJsonValue() throws Exception {