@Test
public void testSetupInstances() {

	new Expectations() {
		{
			for (int i=0; i<parallelism; i++) {
				processor.newProcessor(processor);
				result=processor;
			
				processor.onCreate(anyInt);
			}
		}
	};
	pi.setupInstances();
	List<ThreadsProcessingItemInstance> instances = pi.getProcessingItemInstances();
	assertNotNull("List of PI instances is null.",instances);
	assertEquals("Number of instances does not match parallelism.",parallelism,instances.size(),0);
	for(int i=0; i<instances.size();i++) {
		assertNotNull("Instance "+i+" is null.",instances.get(i));
		assertEquals("Instance "+i+" is not a ThreadsWorkerProcessingItem.",ThreadsProcessingItemInstance.class,instances.get(i).getClass());
	}
}