### Question:
AbstractJaxRsConformanceProvider extends AbstractJaxRsProvider implements IResourceProvider { @GET @Path("/metadata") public Response conformance() throws IOException { setUpPostConstruct(); Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA); IRestfulResponse response = request.build().getResponse(); response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*"); IBaseResource conformance; FhirVersionEnum fhirContextVersion = super.getFhirContext().getVersion().getVersion(); switch (fhirContextVersion) { case R4: conformance = myR4CapabilityStatement; break; case DSTU3: conformance = myDstu3CapabilityStatement; break; case DSTU2_1: conformance = myDstu2_1Conformance; break; case DSTU2_HL7ORG: conformance = myDstu2Hl7OrgConformance; break; case DSTU2: conformance = myDstu2Conformance; break; default: throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); } if (conformance != null) { Set<SummaryEnum> summaryMode = Collections.emptySet(); return (Response) response.streamResponseAsResource(conformance, false, summaryMode, Constants.STATUS_HTTP_200_OK, null, true, false); } return (Response) response.returnResponse(null, Constants.STATUS_HTTP_500_INTERNAL_ERROR, true, null, getResourceType().getSimpleName()); } protected  AbstractJaxRsConformanceProvider(String implementationDescription, String serverName, String serverVersion); protected  AbstractJaxRsConformanceProvider(FhirContext ctx, String implementationDescription, String serverName, String serverVersion); @OPTIONS @Path("/metadata") Response conformanceUsingOptions(); @GET @Path("/metadata") Response conformance(); int addProvider(IResourceProvider theProvider, Class<? extends IResourceProvider> theProviderInterface); @SuppressWarnings("unchecked") @Override Class<IBaseResource> getResourceType();  }### Answer:
@Test public void testConformance() throws Exception { providers.put(AbstractJaxRsConformanceProvider.class, provider); providers.put(TestJaxRsDummyPatientProvider.class, new TestJaxRsDummyPatientProvider()); Response response = createConformanceProvider(providers).conformance(); System.out.println(response); }
@Test public void testConformanceWithMethods() throws Exception { providers.put(AbstractJaxRsConformanceProvider.class, provider); providers.put(TestJaxRsMockPatientRestProvider.class, new TestJaxRsMockPatientRestProvider()); Response response = createConformanceProvider(providers).conformance(); assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus()); assertTrue(response.getEntity().toString().contains("\"type\": \"Patient\"")); assertTrue(response.getEntity().toString().contains("\"someCustomOperation")); System.out.println(response); System.out.println(response.getEntity()); }
@Test public void testConformanceInXml() throws Exception { queryParameters.put(Constants.PARAM_FORMAT, Arrays.asList(Constants.CT_XML)); providers.put(AbstractJaxRsConformanceProvider.class, provider); providers.put(TestJaxRsMockPatientRestProvider.class, new TestJaxRsMockPatientRestProvider()); Response response = createConformanceProvider(providers).conformance(); assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus()); System.out.println(response.getEntity()); assertTrue(response.getEntity().toString().contains(" <type value=\"Patient\"/>")); assertTrue(response.getEntity().toString().contains("\"someCustomOperation")); System.out.println(response.getEntity()); }