/**
  * Create a Failed API Response
  *
  * This assumes the json_encode serializer.
  *
  * @param int $httpCode
  * @param int $errorCode
  * @param string|null $errorTitle
  * @param mixed|null $errorData
  *
  * @return Response
  */
 public function generateErrorResponse($httpCode = null, $errorCode = null, $errorTitle = null, $errorData = null)
 {
     // Set defaults.
     if (null === $httpCode) {
         $httpCode = Response::HTTP_INTERNAL_SERVER_ERROR;
     }
     if (null === $errorCode) {
         $errorCode = 0;
     }
     $apiErrorModel = (new ApiResponseErrorModel())->setCode($errorCode)->setTitle($errorTitle)->setErrorData($errorData);
     $apiResponseModel = (new ApiResponseResponseModel())->addError($apiErrorModel);
     $serializerAdapter = $this->serializerAdapterFactory->createSerializerAdapter(Configuration::SERIALIZER_JSON_ENCODE);
     $jsonString = $serializerAdapter->serialize($apiResponseModel);
     $response = new Response($jsonString, $httpCode, ['Content-Type' => 'application/json']);
     return $response;
 }
 public function testUnrecognized()
 {
     $adapterFactory = new SerializerAdapterFactory(AppMocker::getUnusedContainer());
     $this->setExpectedException(\RuntimeException::class);
     $adapterFactory->createSerializerAdapter('AN_UNSUPPORTED_ADAPTER');
 }