### Question:
ProviderAPI extends RestAbstract { @GET @Path("/{id}") @Produces(CONTENT_TYPE_JSON + ";qs=.5") public Response getProviderJSON(@PathParam("id") int id) { logger.info("GET /" + id + " [JSON]"); return prepareProviderResponse(id, true); }  @GET @Path("/") @Produces(CONTENT_TYPE_XML + ";qs=1") Response getProviders(); @GET @Path("/") @Produces(CONTENT_TYPE_JSON + ";qs=.5") Response getProvidersJSON(); @GET @Path("/{id}") @Produces(CONTENT_TYPE_XML + ";qs=1") Response getProvider(@PathParam("id") int id); @GET @Path("/{id}") @Produces(CONTENT_TYPE_JSON + ";qs=.5") Response getProviderJSON(@PathParam("id") int id); @POST @Path("/") @Consumes(CONTENT_TYPE_XML) @Produces(CONTENT_TYPE_XML) Response postProvider(String payload); @DELETE @Path("/{id}") Response deleteProvider(@PathParam("id") int id); @PUT @Path("/{id}") @Consumes(CONTENT_TYPE_XML) @Produces(CONTENT_TYPE_XML) Response putProvider(@PathParam("id") int id, String payload);  }### Answer:
@Test public void getProviderJSONTest() throws Exception { ProviderAPI providerAPI = new ProviderAPI(); providerAPI.providerDAO = providerDAO; List<Provider> providers = providerDAO.getAll(); int id = providers.get(0).getId(); Response response = providerAPI.getProviderJSON(id); assertEquals(200, response.getStatus()); String providerJSON = (String) response.getEntity(); JSONParser parser = new JSONParser(); Object obj = parser.parse(providerJSON); JSONObject jsonObject = (JSONObject) obj; assertEquals("Provider 1", jsonObject.get("name")); }