### Question:
CreateRelation implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) { String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId"); String pnfName = (String) delegateExecution.getVariable("pnfCorrelationId"); try { pnfManagementImpl.createRelation(serviceInstanceId, pnfName); } catch (Exception e) { logger.error("An exception occurred when making service and pnf relation. Exception:", e); new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999, "An exception occurred when making service and pnf relation. Exception: " + e.getMessage()); } logger.debug("The relation has been made between service with id: {} and pnf with name: {}", serviceInstanceId, pnfName); } @Autowired  CreateRelation(PnfManagement pnfManagementImpl); @Override void execute(DelegateExecution delegateExecution);  }### Answer:
@Test public void shouldThrowBpmnErrorWhenExceptionOccurred() { CreateRelation testedObject = new CreateRelation(new PnfManagementThrowingException()); executionFake.setVariable("testProcessKey", "testProcessKeyValue"); assertThatThrownBy(() -> testedObject.execute(executionFake)).isInstanceOf(BpmnError.class); }