ThreadsComponentFactory implements ComponentFactory { @Override public ProcessingItem createPi(Processor processor) { return this.createPi(processor, 1); }  @Override ProcessingItem createPi(Processor processor); @Override ProcessingItem createPi(Processor processor, int paralellism); @Override EntranceProcessingItem createEntrancePi(EntranceProcessor entranceProcessor); @Override Stream createStream(IProcessingItem sourcePi); @Override Topology createTopology(String topoName);  }
@Test public void testCreatePiNoParallelism() { new NonStrictExpectations() { { processor.newProcessor(processor); result=processorReplica; } }; ProcessingItem pi = factory.createPi(processor); assertNotNull("ProcessingItem created is null.",pi); assertEquals("ProcessingItem created is not a ThreadsProcessingItem.",ThreadsProcessingItem.class,pi.getClass()); assertEquals("Parallelism of PI is not 1",1,pi.getParallelism(),0); }
@Test public void testCreatePiWithParallelism() { new NonStrictExpectations() { { processor.newProcessor(processor); result=processorReplica; } }; ProcessingItem pi = factory.createPi(processor,parallelism); assertNotNull("ProcessingItem created is null.",pi); assertEquals("ProcessingItem created is not a ThreadsProcessingItem.",ThreadsProcessingItem.class,pi.getClass()); assertEquals("Parallelism of PI is not ",parallelism,pi.getParallelism(),0); }