+ r := NewRouter(nil)
+ statusRoute := r.Get("status")
+ assertions.NotNil(statusRoute)
+ supportedMethods, err := statusRoute.GetMethods()
+ assertions.Equal([]string{http.MethodGet}, supportedMethods)
+ assertions.Nil(err)
+ path, _ := statusRoute.GetPathTemplate()
+ assertions.Equal("/status", path)
+
+ addJobRoute := r.Get("add")
+ assertions.NotNil(addJobRoute)
+ supportedMethods, err = addJobRoute.GetMethods()
+ assertions.Equal([]string{http.MethodPost}, supportedMethods)
+ assertions.Nil(err)
+ path, _ = addJobRoute.GetPathTemplate()
+ assertions.Equal("/jobs", path)
+
+ deleteJobRoute := r.Get("delete")
+ assertions.NotNil(deleteJobRoute)
+ supportedMethods, err = deleteJobRoute.GetMethods()
+ assertions.Equal([]string{http.MethodDelete}, supportedMethods)
+ assertions.Nil(err)
+ path, _ = deleteJobRoute.GetPathTemplate()
+ assertions.Equal("/jobs/{infoJobId}", path)
+
+ notFoundHandler := r.NotFoundHandler
+ handler := http.HandlerFunc(notFoundHandler.ServeHTTP)
+ responseRecorder := httptest.NewRecorder()
+ handler.ServeHTTP(responseRecorder, newRequest("GET", "/wrong", nil, t))
+ assertions.Equal(http.StatusNotFound, responseRecorder.Code)
+ assertions.Contains(responseRecorder.Body.String(), "404 not found.")
+
+ methodNotAllowedHandler := r.MethodNotAllowedHandler
+ handler = http.HandlerFunc(methodNotAllowedHandler.ServeHTTP)
+ responseRecorder = httptest.NewRecorder()
+ handler.ServeHTTP(responseRecorder, newRequest(http.MethodPut, "/status", nil, t))
+ assertions.Equal(http.StatusMethodNotAllowed, responseRecorder.Code)
+ assertions.Contains(responseRecorder.Body.String(), "Method is not supported.")