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