/**
  * It should mark iterations as rejected if they deviate too far from the mean.
  */
 public function testReject()
 {
     $iterations = new IterationCollection($this->subject->reveal(), $this->parameterSet->reveal(), 50);
     $iterations->replace(array($iter1 = $this->createIteration(4, -50), $iter2 = $this->createIteration(8, 0), $iter3 = $this->createIteration(4, -50), $iter4 = $this->createIteration(16, 100)));
     $iterations->computeStats();
     $this->assertCount(3, $iterations->getRejects());
     $this->assertContains($iter1, $iterations->getRejects());
     $this->assertContains($iter3, $iterations->getRejects());
     $this->assertContains($iter4, $iterations->getRejects());
     $this->assertNotContains($iter2, $iterations->getRejects());
 }
 /**
  * It should throw an exception if getStats is called when an exception has been set.
  *
  * @expectedException RuntimeException
  * @expectedExceptionMessage Cannot retrieve stats when an exception
  */
 public function testGetStatsWithExceptionException()
 {
     $iterations = new IterationCollection($this->subject->reveal(), $this->parameterSet->reveal(), 1, 1, 0);
     $iterations[0]->setResult(new IterationResult(4, null));
     $iterations->computeStats();
     $iterations->setException(new \Exception('Test'));
     $iterations->getStats();
 }