Search in sources :

Example 6 with RequestContext

use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.

the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithPrefix.

@PathPatternsParameterizedTest
void testGetViewNameWithPrefix(Function<String, RequestContext> requestFactory) {
    final String prefix = "fiona_";
    RequestContext request = requestFactory.apply(VIEW_NAME);
    this.translator.setPrefix(prefix);
    assertViewName(request, prefix + VIEW_NAME);
}
Also used : RequestContext(cn.taketoday.web.RequestContext) MockServletRequestContext(cn.taketoday.web.servlet.MockServletRequestContext)

Example 7 with RequestContext

use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.

the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithNoExtension.

@PathPatternsParameterizedTest
void testGetViewNameWithNoExtension(Function<String, RequestContext> requestFactory) {
    RequestContext request = requestFactory.apply(VIEW_NAME);
    assertViewName(request, VIEW_NAME);
}
Also used : RequestContext(cn.taketoday.web.RequestContext) MockServletRequestContext(cn.taketoday.web.servlet.MockServletRequestContext)

Example 8 with RequestContext

use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.

the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithNullSuffix.

@PathPatternsParameterizedTest
void testGetViewNameWithNullSuffix(Function<String, RequestContext> requestFactory) {
    RequestContext request = requestFactory.apply(VIEW_NAME);
    this.translator.setSuffix(null);
    assertViewName(request, VIEW_NAME);
}
Also used : RequestContext(cn.taketoday.web.RequestContext) MockServletRequestContext(cn.taketoday.web.servlet.MockServletRequestContext)

Example 9 with RequestContext

use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.

the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithSemicolonContent.

@PathPatternsParameterizedTest
void testGetViewNameWithSemicolonContent(Function<String, RequestContext> requestFactory) {
    RequestContext request = requestFactory.apply(VIEW_NAME + ";a=A;b=B");
    assertViewName(request, VIEW_NAME);
}
Also used : RequestContext(cn.taketoday.web.RequestContext) MockServletRequestContext(cn.taketoday.web.servlet.MockServletRequestContext)

Example 10 with RequestContext

use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.

the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithDefaultConfiguration.

@PathPatternsParameterizedTest
void testGetViewNameWithDefaultConfiguration(Function<String, RequestContext> requestFactory) {
    RequestContext request = requestFactory.apply(VIEW_NAME + EXTENSION);
    assertViewName(request, VIEW_NAME);
}
Also used : RequestContext(cn.taketoday.web.RequestContext) MockServletRequestContext(cn.taketoday.web.servlet.MockServletRequestContext)

Aggregations

RequestContext (cn.taketoday.web.RequestContext)109 ServletRequestContext (cn.taketoday.web.servlet.ServletRequestContext)65 MockServletRequestContext (cn.taketoday.web.servlet.MockServletRequestContext)46 Test (org.junit.jupiter.api.Test)42 ModelAndView (cn.taketoday.web.view.ModelAndView)22 PathPatternsParameterizedTest (cn.taketoday.web.view.PathPatternsParameterizedTest)22 HashMap (java.util.HashMap)22 MockHttpServletRequest (cn.taketoday.web.mock.MockHttpServletRequest)12 MockHttpServletRequest (cn.taketoday.web.testfixture.servlet.MockHttpServletRequest)12 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)12 HttpServletResponse (jakarta.servlet.http.HttpServletResponse)12 WebServletApplicationContext (cn.taketoday.web.servlet.WebServletApplicationContext)10 MockHttpServletResponse (cn.taketoday.web.mock.MockHttpServletResponse)9 MockHttpServletResponse (cn.taketoday.web.testfixture.servlet.MockHttpServletResponse)9 Map (java.util.Map)8 Properties (java.util.Properties)8 MockServletContext (cn.taketoday.web.mock.MockServletContext)6 WebSession (cn.taketoday.web.session.WebSession)6 MockServletContext (cn.taketoday.web.testfixture.servlet.MockServletContext)6 View (cn.taketoday.web.view.View)6