### Question:
BusinessDataReferenceResource extends CommonResource { @Get("json") public BusinessDataReferenceClient getProcessBusinessDataReference() throws DataNotFoundException { final String businessDataName = getPathParam("dataName"); final Long processInstanceId = getPathParamAsLong("caseId"); return toClient(bdmAPI.getProcessBusinessDataReference(businessDataName, processInstanceId)); } BusinessDataReferenceResource(final BusinessDataAPI bdmAPI); @Get("json") BusinessDataReferenceClient getProcessBusinessDataReference(); static BusinessDataReferenceClient toClient(BusinessDataReference object);  }### Answer:
@Test public void should_return_the_simple_reference_of_the_business_data_of_the_process_instance() throws Exception { final SimpleBusinessDataReference reference= buildSimpleEmployeeReference("myEmployee", 487467354L); when(bdmAPI.getProcessBusinessDataReference("myEmployee", 486L)).thenReturn(reference); final Response response = request("/bdm/businessDataReference/486/myEmployee").get(); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response).hasJsonEntityEqualTo(readFile("simpleRef.json")); }
@Test public void should_return_the_multi_reference_of_the_business_data_of_the_process_instance() throws Exception { final MultipleBusinessDataReference reference= buildMultipleEmployeeReference("myEmployee", 487467354L, 48674634L); when(bdmAPI.getProcessBusinessDataReference("myEmployee", 486L)).thenReturn(reference); final Response response = request("/bdm/businessDataReference/486/myEmployee").get(); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response).hasJsonEntityEqualTo(readFile("multiRef.json")); }
@Test public void should_return_a_not_found_status() throws Exception { when(bdmAPI.getProcessBusinessDataReference("myEmployee", 486L)).thenThrow(new DataNotFoundException(new Exception("message"))); final Response response = request("/bdm/businessDataReference/486/myEmployee").get(); assertThat(response).hasStatus(Status.CLIENT_ERROR_NOT_FOUND); assertThat(response).hasJsonEntityEqualTo("{\"exception\":\"class org.bonitasoft.engine.bpm.data.DataNotFoundException\",\"message\":\"java.lang.Exception: message\"}"); }