### Question:
SimulationService implements WorkflowContext { public ItemCollection processWorkItem(final ItemCollection _workitem, final List<String> vPlugins) throws AccessDeniedException, ProcessingErrorException, PluginException, ModelException { ItemCollection workitem = _workitem; long l = System.currentTimeMillis(); if (workitem == null) throw new ProcessingErrorException(SimulationService.class.getSimpleName(), ProcessingErrorException.INVALID_WORKITEM, "WorkflowService: error - workitem is null"); if (events != null) { events.fire(new ProcessingEvent(workitem, ProcessingEvent.BEFORE_PROCESS)); } else { logger.warning("CDI Support is missing - ProcessingEvent will not be fired"); } WorkflowKernel workflowkernel = new WorkflowKernel(this); if (vPlugins != null && vPlugins.size() > 0) { for (int i = 0; i < vPlugins.size(); i++) { String aPluginClassName = vPlugins.get(i); Plugin aPlugin = findPluginByName(aPluginClassName); if (aPlugin != null) { logger.fine("register CDI plugin class: " + aPluginClassName + "..."); workflowkernel.registerPlugin(aPlugin); } else { workflowkernel.registerPlugin(aPluginClassName); } } } try { workitem = workflowkernel.process(workitem); } catch (PluginException pe) { logger.severe("processing workitem '" + workitem.getItemValueString(WorkflowKernel.UNIQUEID) + " failed, rollback transaction..."); throw pe; } logger.fine("workitem '" + workitem.getItemValueString(WorkflowKernel.UNIQUEID) + "' simulated in " + (System.currentTimeMillis() - l) + "ms"); if (events != null) { events.fire(new ProcessingEvent(workitem, ProcessingEvent.AFTER_PROCESS)); } List<ItemCollection> splitWorkitems = workflowkernel.getSplitWorkitems(); for (ItemCollection splitWorkitemm : splitWorkitems) { if (events != null) { events.fire(new ProcessingEvent(splitWorkitemm, ProcessingEvent.AFTER_PROCESS)); } } return workitem; }  ModelService getModelService(); void setModelService(ModelService modelService); SessionContext getCtx(); void setCtx(SessionContext ctx); ItemCollection processWorkItem(final ItemCollection _workitem, final List<String> vPlugins); ModelManager getModelManager(); SessionContext getSessionContext();  }### Answer:
@Test public void testConditionalEvent1() throws AccessDeniedException, ProcessingErrorException, PluginException, ModelException { WorkflowSimulationEnvironment wse = new WorkflowSimulationEnvironment(); wse.setUp(); wse.loadModel("/bpmn/conditional_event1.bpmn"); ItemCollection workitem = new ItemCollection(); workitem.replaceItemValue(WorkflowKernel.MODELVERSION, WorkflowSimulationEnvironment.DEFAULT_MODEL_VERSION); workitem.setTaskID(1000); workitem.setEventID(10); workitem = wse.processWorkItem(workitem); Assert.assertEquals("1.0.0", workitem.getItemValueString("$ModelVersion")); Assert.assertEquals(1000, workitem.getTaskID()); workitem.setTaskID(1000); workitem.replaceItemValue("_budget", 99); workitem.setEventID(10); workitem = wse.simulationService.processWorkItem(workitem, null); Assert.assertEquals(1200, workitem.getTaskID()); workitem.setTaskID(1000); workitem.replaceItemValue("_budget", 9999); workitem.setEventID(10); workitem = wse.simulationService.processWorkItem(workitem, null); Assert.assertEquals(1100, workitem.getTaskID()); }