### Question:
AbstractJaxRsResourceProvider extends AbstractJaxRsProvider implements IRestfulServer<JaxRsRequest>, IResourceProvider { @GET @Path("/{id : ((?!_history).)*}") public Response find(@PathParam("id") final String id) throws IOException { return execute(getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.READ).id(id)); } protected  AbstractJaxRsResourceProvider(); protected  AbstractJaxRsResourceProvider(final FhirContext ctx); protected  AbstractJaxRsResourceProvider(final Class<? extends AbstractJaxRsProvider> theProviderClass); protected  AbstractJaxRsResourceProvider(final FhirContext ctx, final Class<? extends AbstractJaxRsProvider> theProviderClass); @Override String getBaseForRequest(); @POST Response create(final String resource); @POST @Path("/_search") Response searchWithPost(); @GET Response search(); @PUT Response conditionalUpdate(final String resource); @PUT @Path("/{id}") Response update(@PathParam("id") final String id, final String resource); @DELETE Response delete(); @DELETE @Path("/{id}") Response delete(@PathParam("id") final String id); @GET @Path("/{id : ((?!_history).)*}") Response find(@PathParam("id") final String id); @GET @Path("/{id}/_history/{version}") Response findVersion(@PathParam("id") final String id, @PathParam("version") final String version); @GET @Path("/{id}/_history") Response historyForInstance(@PathParam("id") final String id); @GET @Path("/_history") Response historyForType(); @GET @Path("/{id}/{compartment : ((?!_history).)*}") Response findCompartment(@PathParam("id") final String id, @PathParam("compartment") final String compartment); @POST @Path("/$validate") Response validate(final String resource); @Override IPagingProvider getPagingProvider(); @Override BundleInclusionRule getBundleInclusionRule(); @Override PreferReturnEnum getDefaultPreferReturn(); @Override abstract Class<R> getResourceType(); JaxRsMethodBindings getBindings();  }### Answer:
@Test public void findUsingGenericClientById() { when(mock.find(any(IdDt.class))).thenReturn(createPatient(1)); Patient result = client.read(Patient.class, "1"); compareResultId(1, result); compareResultUrl("/Patient/1", result); reset(mock); when(mock.find(withId(result.getId()))).thenReturn(createPatient(1)); result = (Patient) client.read(new UriDt(result.getId().getValue())); compareResultId(1, result); compareResultUrl("/Patient/1", result); }
@Test public void testRead() { when(mock.find(idCaptor.capture())).thenReturn(createPatient(1)); final Patient patient = client.read(Patient.class, "1"); compareResultId(1, patient); compareResultUrl("/Patient/1", patient); assertEquals("1", idCaptor.getValue().getIdPart()); }
@Test public void testXFindUnknownPatient() { try { JaxRsResponseException notFoundException = new JaxRsResponseException(new ResourceNotFoundException(new IdDt("999955541264"))); when(mock.find(idCaptor.capture())).thenThrow(notFoundException); client.read(Patient.class, "999955541264"); fail(); } catch (final ResourceNotFoundException e) { assertEquals(ResourceNotFoundException.STATUS_CODE, e.getStatusCode()); assertTrue(e.getMessage().contains("999955541264")); } }