### Question:
LastKnownLocationResource { @Path("/vehicle/{vehicleId}") @GET @Produces("application/json") public Response getlastLocationRecordForVehicle(@PathParam("vehicleId") Integer vehicleId) { _log.debug("Starting getlastLocationRecordForVehicle."); String outputJson; try { List<CcAndInferredLocationRecord> records = getLastKnownRecordForVehicleFromDao(vehicleId); LastKnownRecordMessage message = new LastKnownRecordMessage(); message.setRecords(records); message.setStatus("OK"); outputJson = getObjectAsJsonString(message); } catch (Exception e) { throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); } Response response = Response.ok(outputJson, "application/json").build(); _log.debug("Returning ok response from getlastLocationRecordForVehicle"); return response; }  void set_locationDao(CcAndInferredLocationDao _locationDao); void set_jsonTool(JsonTool _jsonTool); @Path("/vehicle/{vehicleId}") @GET @Produces("application/json") Response getlastLocationRecordForVehicle(@PathParam("vehicleId") Integer vehicleId); @Path("/list") @GET @Produces("application/json") Response getAllLastLocationRecords(
			@QueryParam(value="depot-id") final String depotId,
			@QueryParam(value="inferred-route-id") final String inferredRouteId,
			@QueryParam(value="inferred-phase") final String inferredPhase,
			@QueryParam(value="bbox") final String boundingBox);  }### Answer:
@Test public void testGetlastLocationRecordForVehicle() throws Exception { LastKnownLocationResource r = new LastKnownLocationResource(); CcAndInferredLocationDao dao = mock(CcAndInferredLocationDao.class); CcAndInferredLocationRecord ccAndInf = new CcAndInferredLocationRecord(); ccAndInf.setAssignedBlockId("assigned block id"); when(dao.getLastKnownRecordForVehicle(any(Integer.class))).thenReturn(ccAndInf); r.set_locationDao(dao); r.set_jsonTool(new LowerCaseWDashesGsonJsonTool(true)); Response response = r.getlastLocationRecordForVehicle(123); assertEquals(200, response.getStatus()); Object entity = response.getEntity(); assertJsonPartEquals("assigned block id", entity.toString(),"records[0].assigned-block-id"); }