Search in sources :

Example 6 with NoHandlerFoundException

use of org.springframework.web.servlet.NoHandlerFoundException in project spring-framework by spring-projects.

the class ResponseEntityExceptionHandlerTests method noHandlerFoundException.

@Test
public void noHandlerFoundException() {
    ServletServerHttpRequest req = new ServletServerHttpRequest(new MockHttpServletRequest("GET", "/resource"));
    Exception ex = new NoHandlerFoundException(req.getMethod().toString(), req.getServletRequest().getRequestURI(), req.getHeaders());
    testException(ex);
}
Also used : ServletServerHttpRequest(org.springframework.http.server.ServletServerHttpRequest) MockHttpServletRequest(org.springframework.web.testfixture.servlet.MockHttpServletRequest) NoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException) MissingPathVariableException(org.springframework.web.bind.MissingPathVariableException) ServletException(jakarta.servlet.ServletException) HttpMessageNotWritableException(org.springframework.http.converter.HttpMessageNotWritableException) NoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException) MissingServletRequestPartException(org.springframework.web.multipart.support.MissingServletRequestPartException) BindException(org.springframework.validation.BindException) ConversionNotSupportedException(org.springframework.beans.ConversionNotSupportedException) AsyncRequestTimeoutException(org.springframework.web.context.request.async.AsyncRequestTimeoutException) MissingServletRequestParameterException(org.springframework.web.bind.MissingServletRequestParameterException) MethodArgumentNotValidException(org.springframework.web.bind.MethodArgumentNotValidException) ServletRequestBindingException(org.springframework.web.bind.ServletRequestBindingException) TypeMismatchException(org.springframework.beans.TypeMismatchException) HttpMessageNotReadableException(org.springframework.http.converter.HttpMessageNotReadableException) HttpMediaTypeNotSupportedException(org.springframework.web.HttpMediaTypeNotSupportedException) HttpRequestMethodNotSupportedException(org.springframework.web.HttpRequestMethodNotSupportedException) HttpMediaTypeNotAcceptableException(org.springframework.web.HttpMediaTypeNotAcceptableException) Test(org.junit.jupiter.api.Test)

Aggregations

NoHandlerFoundException (org.springframework.web.servlet.NoHandlerFoundException)6 ModelAndView (org.springframework.web.servlet.ModelAndView)5 ServletException (javax.servlet.ServletException)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)4 HandlerMethod (org.springframework.web.method.HandlerMethod)4 HandlerExceptionResolver (org.springframework.web.servlet.HandlerExceptionResolver)4 ApiResponse (com.rogge.common.core.ApiResponse)3 ServiceException (com.rogge.common.core.ServiceException)3 IOException (java.io.IOException)3 TooManyResultsException (org.apache.ibatis.exceptions.TooManyResultsException)3 Test (org.junit.jupiter.api.Test)2 ServletServerHttpRequest (org.springframework.http.server.ServletServerHttpRequest)2 MockHttpServletRequest (org.springframework.web.testfixture.servlet.MockHttpServletRequest)2 ApplicationException (com.company.project.core.ApplicationException)1 Result (com.company.project.core.Result)1 ServletException (jakarta.servlet.ServletException)1 ConversionNotSupportedException (org.springframework.beans.ConversionNotSupportedException)1 TypeMismatchException (org.springframework.beans.TypeMismatchException)1 HttpMessageNotReadableException (org.springframework.http.converter.HttpMessageNotReadableException)1