@Test
public void testParallelForLoop() throws Exception {

  final List<Integer> input = new LinkedList<Integer>();
  for(int i = 0; i < 10; i++) {
    input.add(i);
  }
  ParallelLoopResult<Integer> loopResult = Parallel.forLoop(input, new LoopBody<Integer, Integer>() {
    @Override
    public Integer run(Integer in1) {
      return in1 * in1;
    }
  });
  Assert.assertTrue(loopResult.getIsCompleted());
  Assert.assertNotNull(loopResult.getResult());
  List<Integer> output = loopResult.getResult();
  Assert.assertEquals(input.size(), output.size());
  for(int i = 0; i < input.size(); i++) {
    Assert.assertEquals( i * i,  (int)output.get(i));
  }
}