### Question:
CaseContextResource extends CommonResource { protected long getCaseIdParameter() { final String caseId = getAttribute(CASE_ID); if (caseId == null) { throw new APIException("Attribute '" + CASE_ID + "' is mandatory in order to get the case context"); } return Long.parseLong(caseId); } CaseContextResource(final ProcessAPI processAPI, FinderFactory resourceHandler); @Get("json") Map<String, Serializable> getCaseContext();  }### Answer:
@Test public void should_getTaskIDParameter_throws_an_exception_when_task_id_parameter_is_null() throws Exception { doReturn(null).when(caseContextResource).getAttribute(CaseContextResource.CASE_ID); try { caseContextResource.getCaseIdParameter(); } catch (final Exception e) { Assertions.assertThat(e).isInstanceOf(APIException.class); Assertions.assertThat(e.getMessage()).isEqualTo("Attribute '" + CaseContextResource.CASE_ID + "' is mandatory in order to get the case context"); } }