SimpleProcessingItem extends AbstractProcessingItem { public void processEvent(ContentEvent event, int counter) { int parallelism = this.getParallelism(); if (this.arrayProcessingItem == null && parallelism > 0) { this.arrayProcessingItem = new IProcessingItem[parallelism]; for (int j = 0; j < parallelism; j++) { arrayProcessingItem[j] = this.copy(); arrayProcessingItem[j].getProcessor().onCreate(j); } } if (this.arrayProcessingItem != null) { IProcessingItem pi = this.getProcessingItem(counter); Processor p = pi.getProcessor(); this.getProcessingItem(counter).getProcessor().process(event); } } SimpleProcessingItem(Processor processor);   SimpleProcessingItem(Processor processor, int parallelism); IProcessingItem getProcessingItem(int i); SimpleProcessingItem copy(); void processEvent(ContentEvent event, int counter);  }
@Test public void testProcessEvent() { new Expectations() { { for (int i=0; i<parallelism; i++) { processor.newProcessor(processor); result=processor; processor.onCreate(anyInt); } processor.process(event); } }; pi.processEvent(event, counter); }