Add a disabled JAX-RS test

This commit is contained in:
James Agnew 2016-03-12 14:16:00 -05:00
parent ce253bed70
commit 270ba270cc
2 changed files with 13 additions and 6 deletions

View File

@ -350,13 +350,17 @@ public class AbstractJaxRsResourceProviderTest {
compareResultId(1, patientCaptor.getValue()); compareResultId(1, patientCaptor.getValue());
} }
@Test @SuppressWarnings("unchecked")
@Ignore @Ignore
public void testUpdateByWrongId() throws Exception { @Test
when(mock.update(idCaptor.capture(), patientCaptor.capture())).thenReturn(new MethodOutcome()); public void testResourceNotFound() throws Exception {
client.update("1", createPatient(2)); when(mock.update(idCaptor.capture(), patientCaptor.capture())).thenThrow(ResourceNotFoundException.class);
assertEquals("1", idCaptor.getValue().getIdPart()); try {
compareResultId(1, patientCaptor.getValue()); client.update("1", createPatient(2));
fail();
} catch (ResourceNotFoundException e) {
// good
}
} }
@Test @Test

View File

@ -3,6 +3,7 @@ package ca.uhn.fhir.jaxrs.server.test;
import java.util.List; import java.util.List;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -14,6 +15,7 @@ import javax.ws.rs.core.Response;
import org.mockito.Mockito; import org.mockito.Mockito;
import ca.uhn.fhir.jaxrs.server.AbstractJaxRsResourceProvider; import ca.uhn.fhir.jaxrs.server.AbstractJaxRsResourceProvider;
import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsExceptionInterceptor;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu2.resource.Parameters; import ca.uhn.fhir.model.dstu2.resource.Parameters;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
@ -45,6 +47,7 @@ import ca.uhn.fhir.rest.server.IPagingProvider;
@Path(TestJaxRsMockPatientRestProvider.PATH) @Path(TestJaxRsMockPatientRestProvider.PATH)
@Stateless @Stateless
@Produces({ MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML }) @Produces({ MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML })
@Interceptors(JaxRsExceptionInterceptor.class)
public class TestJaxRsMockPatientRestProvider extends AbstractJaxRsResourceProvider<Patient> { public class TestJaxRsMockPatientRestProvider extends AbstractJaxRsResourceProvider<Patient> {
static final String PATH = "/Patient"; static final String PATH = "/Patient";