### Question:
UserTaskContractResource extends CommonResource { protected long getTaskIdParameter() { final String taskId = getAttribute(TASK_ID); if (taskId == null) { throw new APIException("Attribute '" + TASK_ID + "' is mandatory"); } return Long.parseLong(taskId); } UserTaskContractResource(final ProcessAPI processAPI); @Get("json") ContractDefinition getContract();  }### Answer:
@Test public void should_getTaskIDParameter_throws_an_exception_when_task_id_parameter_is_null() throws Exception { doReturn(null).when(taskContractResource).getAttribute(UserTaskContractResource.TASK_ID); try { taskContractResource.getTaskIdParameter(); } catch (final Exception e) { assertThat(e).isInstanceOf(APIException.class); assertThat(e.getMessage()).isEqualTo("Attribute '" + UserTaskContractResource.TASK_ID + "' is mandatory"); } }