+func TestHandleRoutingManagerError(t *testing.T) {
+ controller, _, _, _, _ := setupControllerTest(t)
+ writer := httptest.NewRecorder()
+ err := e2managererrors.NewRoutingManagerError()
+
+ controller.handleErrorResponse(err, writer)
+ var errorResponse = parseJsonRequest(t, writer.Body)
+
+ assert.Equal(t, http.StatusServiceUnavailable, writer.Result().StatusCode)
+ assert.Equal(t, errorResponse.Code, err.Code)
+ assert.Equal(t, errorResponse.Message, err.Message)
+}
+
+func TestHandleE2TInstanceAbsenceError(t *testing.T) {
+ controller, _, _, _, _ := setupControllerTest(t)
+
+ writer := httptest.NewRecorder()
+ err := e2managererrors.NewE2TInstanceAbsenceError()
+
+ controller.handleErrorResponse(err, writer)
+ var errorResponse = parseJsonRequest(t, writer.Body)
+
+ assert.Equal(t, http.StatusServiceUnavailable, writer.Result().StatusCode)
+ assert.Equal(t, errorResponse.Code, err.Code)
+ assert.Equal(t, errorResponse.Message, err.Message)
+}
+
+func TestValidateHeaders(t *testing.T) {
+ controller, _, _, _, _ := setupControllerTest(t)
+
+ header := http.Header{}
+ header.Set("Content-Type", "application/json")
+ result := controller.validateRequestHeader(&header)
+
+ assert.Nil(t, result)
+}
+
+func parseJsonRequest(t *testing.T, r io.Reader) models.ErrorResponse {
+
+ var errorResponse models.ErrorResponse
+ body, err := ioutil.ReadAll(r)
+ if err != nil {
+ t.Errorf("Error cannot deserialize json request")