### Question:
UnassignNetworkBB { public void errorEncountered(BuildingBlockExecution execution) { String msg; boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false; if (isRollbackNeeded) { msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback; } else { msg = execution.getVariable("ErrorUnassignNetworkBB"); } exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); }  void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue); void getCloudSdncRegion(BuildingBlockExecution execution); void errorEncountered(BuildingBlockExecution execution);  }### Answer:
@Test public void errorEncounteredTest_rollback() throws Exception { expectedException.expect(BpmnError.class); execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); execution.setVariable("isRollbackNeeded", true); unassignNetworkBB.errorEncountered(execution); }
@Test public void errorEncounteredTest_noRollback() throws Exception { expectedException.expect(BpmnError.class); execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); unassignNetworkBB.errorEncountered(execution); }