Skip to content

Instantly share code, notes, and snippets.

@mosdevly
Last active April 16, 2020 20:53
Show Gist options
  • Save mosdevly/6a90cc2daa532dcf2d7413d1ed2146c0 to your computer and use it in GitHub Desktop.
Save mosdevly/6a90cc2daa532dcf2d7413d1ed2146c0 to your computer and use it in GitHub Desktop.
@Test
void createDriver() throws Exception {
String driverJson = "{\"nickname\": \"Speed Racer\", \"firstName\": \"Tester\", \"lastName\": \"McTesty\", \"birthday\": \"1990-04-18\"}";
MockHttpServletRequestBuilder request = post("/api/drivers/new")
.contentType(MediaType.APPLICATION_JSON)
.content(driverJson);
mvc.perform(request)
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").exists());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment