vehicles-api/src/test/java/com/udacity/vehicles/api/CarControllerTest.java
@Test
  public void listCars() throws Exception {
    mvc.perform(get("/cars")
            .accept(MediaType.APPLICATION_JSON))
            .andExpect(jsonPath("_embedded.carList", hasSize(1)))
            .andExpect(jsonPath("_embedded.carList[0].id").value(1))
            .andExpect(jsonPath("_embedded.carList[0].details.body").value("sedan"))
            .andExpect(jsonPath("_embedded.carList[0].details.mileage").value(32280))
            .andExpect(status().isOk());
  }
/**
   * Tests if the read operation appropriately returns a list of vehicles.
   *
   * @throws Exception if the read operation of the vehicle list fails
   */
Tests if the read operation appropriately returns a list of vehicles.
@throws Exception if the read operation of the vehicle list fails
Tests if the read operation appropriately returns a list of vehicles . @throws Exception if the read operation of the vehicle list fails
@Test
  public void listCars() throws Exception {
    mvc.perform(get("/cars")
            .accept(MediaType.APPLICATION_JSON))
            .andExpect(jsonPath("_embedded.carList", hasSize(1)))
            .andExpect(jsonPath("_embedded.carList[0].id").value(1))
            .andExpect(jsonPath("_embedded.carList[0].details.body").value("sedan"))
            .andExpect(jsonPath("_embedded.carList[0].details.mileage").value(32280))
            .andExpect(status().isOk());
  }
@ Test public void listCars ( ) throws Exception { mvc . perform ( get ( "/cars" ) . accept ( MediaType . APPLICATION_JSON ) ) . andExpect ( jsonPath ( "_embedded.carList" , hasSize ( 1 ) ) ) . andExpect ( jsonPath ( "_embedded.carList[0].id" ) . value ( 1 ) ) . andExpect ( jsonPath ( "_embedded.carList[0].details.body" ) . value ( "sedan" ) ) . andExpect ( jsonPath ( "_embedded.carList[0].details.mileage" ) . value ( 32280 ) ) . andExpect ( status ( ) . isOk ( ) ) ; }
Tests if the read operation appropriately returns a list of vehicles.
Tests if the read operation appropriately returns a list of vehicles .