/**
  * Iterate over all sets of data and test the rewriting
  *
  * @param string $testDataSet The dataset to test against
  *
  * @return boolean
  * @throws \Exception
  */
 public function assertionEngine($testDataSet)
 {
     // Do we know this dataset?
     $this->assertArrayHasKey($testDataSet, $this->rewriteDataSets);
     // Get our dataset
     $dataSet = $this->rewriteDataSets[$testDataSet];
     // We will get the rules into our module by ways of the volatile rewrites
     $this->mockRequestContext->setModuleVar(ModuleVars::VOLATILE_REWRITES, $dataSet['rules']);
     // No iterate over the map which is combined with the rules in the dataset
     foreach ($dataSet['map'] as $input => $desiredOutput) {
         // We will provide the crucial information by way of server vars
         $this->mockRequestContext->setServerVar(ServerVars::X_REQUEST_URI, $input);
         // Start the processing
         $this->rewriteModule->process($this->request, $this->response, $this->mockRequestContext, ModuleHooks::REQUEST_POST);
         // If we got a redirect we have to test differently
         if (isset($dataSet['redirect'])) {
             try {
                 // Has the header location been set at all?
                 // If we did not match any redirect condition and will set it to the input so we get some output
                 if (!$this->response->hasHeader(Protocol::HEADER_LOCATION)) {
                     $this->response->addHeader(Protocol::HEADER_LOCATION, $input);
                 }
                 // Asserting that the header location was set correctly
                 $this->assertSame($desiredOutput, $this->response->getHeader(Protocol::HEADER_LOCATION));
                 // If we got a custom status code we have to check for it
                 if (isset($dataSet['redirectAs'])) {
                     $this->assertSame($dataSet['redirectAs'], (int) $this->response->getStatusCode());
                 }
             } catch (\Exception $e) {
                 // Do not forget to reset the response object we are using!!
                 $this->response = new HttpResponse();
                 $this->response->init();
                 // Re-throw the exception
                 throw $e;
             }
         } else {
             // Now check if we got the same thing here
             $this->assertSame($desiredOutput, $this->mockRequestContext->getServerVar(ServerVars::X_REQUEST_URI));
         }
     }
     // Still here? Then we are successful
     return true;
 }