vehicles-api/src/test/java/com/udacity/vehicles/api/CarControllerTest.java
/**
     * Tests the read operation for a single car by ID.
     * @throws Exception if the read operation for a single car fails
     */
Tests the read operation for a single car by ID.
@throws Exception if the read operation for a single car fails
Tests the read operation for a single car by ID . @throws Exception if the read operation for a single car fails
@Test
    public void findCar() throws Exception {
        /**
         * TODO: Add a test to check that the `get` method works by calling
         *   a vehicle by ID. This should utilize the car from `getCar()` below.
         */
        Car myCar = getCar();
        mvc.perform(get(new URI("/cars/1"))).andExpect(content().contentType("application/hal+json;charset=UTF-8"))
                .andExpect(status().isOk()).
                andExpect(jsonPath("$.id").value("1")).
                andExpect(jsonPath("$.details.model").value(myCar.getDetails().getModel())).
                andExpect(jsonPath("$._links.self.href").value("http://localhost/cars/1")).
                andExpect(jsonPath("$._links.cars.href").value("http://localhost/cars"));
    }
@ Test public void findCar ( ) throws Exception { /**
         * TODO: Add a test to check that the `get` method works by calling
         *   a vehicle by ID. This should utilize the car from `getCar()` below.
         */ Car myCar = getCar ( ) ; mvc . perform ( get ( new URI ( "/cars/1" ) ) ) . andExpect ( content ( ) . contentType ( "application/hal+json;charset=UTF-8" ) ) . andExpect ( status ( ) . isOk ( ) ) . andExpect ( jsonPath ( "$.id" ) . value ( "1" ) ) . andExpect ( jsonPath ( "$.details.model" ) . value ( myCar . getDetails ( ) . getModel ( ) ) ) . andExpect ( jsonPath ( "$._links.self.href" ) . value ( "http://localhost/cars/1" ) ) . andExpect ( jsonPath ( "$._links.cars.href" ) . value ( "http://localhost/cars" ) ) ; }
Tests the read operation for a single car by ID.
Tests the read operation for a single car by ID .