Java Code Examples for org.springframework.mock.web.test.MockHttpServletRequest

The following examples show how to use org.springframework.mock.web.test.MockHttpServletRequest. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spring4-understanding   Author: langtianya   File: DispatcherServletTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void cleanupAfterIncludeWithRemove() throws ServletException, IOException {
	MockHttpServletRequest request = new MockHttpServletRequest(getServletContext(), "GET", "/main.do");
	MockHttpServletResponse response = new MockHttpServletResponse();

	request.setAttribute("test1", "value1");
	request.setAttribute("test2", "value2");
	WebApplicationContext wac = new StaticWebApplicationContext();
	request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

	request.setAttribute(WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE, "/form.do");
	simpleDispatcherServlet.service(request, response);

	assertEquals("value1", request.getAttribute("test1"));
	assertEquals("value2", request.getAttribute("test2"));
	assertEquals(wac, request.getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE));
	assertNull(request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE));
	assertNull(request.getAttribute("command"));
}
 
Example #2
Source Project: spring-analysis-note   Author: Vip-Augus   File: ServletRequestDataBinderTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testBindingWithNestedObjectCreation() throws Exception {
	TestBean tb = new TestBean();

	ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "person");
	binder.registerCustomEditor(ITestBean.class, new PropertyEditorSupport() {
		@Override
		public void setAsText(String text) throws IllegalArgumentException {
			setValue(new TestBean());
		}
	});

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addParameter("spouse", "someValue");
	request.addParameter("spouse.name", "test");
	binder.bind(request);

	assertNotNull(tb.getSpouse());
	assertEquals("test", tb.getSpouse().getName());
}
 
Example #3
Source Project: spring4-understanding   Author: langtianya   File: ViewResolutionIntegrationTests.java    License: Apache License 2.0 6 votes vote down vote up
private MockHttpServletResponse runTest(Class<?> configClass) throws ServletException, IOException {
	String basePath = "org/springframework/web/servlet/config/annotation";
	MockServletContext servletContext = new MockServletContext(basePath);
	MockServletConfig servletConfig = new MockServletConfig(servletContext);
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
	MockHttpServletResponse response = new MockHttpServletResponse();

	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(configClass);
	context.setServletContext(servletContext);
	context.refresh();
	DispatcherServlet servlet = new DispatcherServlet(context);
	servlet.init(servletConfig);
	servlet.service(request, response);
	return response;
}
 
Example #4
Source Project: spring-analysis-note   Author: Vip-Augus   File: UriComponentsBuilderTests.java    License: MIT License 6 votes vote down vote up
@Test
public void fromHttpRequestForwardedHeaderWithHostPortAndServerPort()  {
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addHeader("Forwarded", "proto=https; host=84.198.58.199:9090");
	request.setScheme("http");
	request.setServerPort(8080);
	request.setServerName("example.com");
	request.setRequestURI("/rest/mobile/users/1");

	HttpRequest httpRequest = new ServletServerHttpRequest(request);
	UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build();

	assertEquals("https", result.getScheme());
	assertEquals("84.198.58.199", result.getHost());
	assertEquals("/rest/mobile/users/1", result.getPath());
	assertEquals(9090, result.getPort());
	assertEquals("https://84.198.58.199:9090/rest/mobile/users/1", result.toUriString());
}
 
Example #5
Source Project: spring-analysis-note   Author: Vip-Augus   File: MarshallingViewTests.java    License: MIT License 6 votes vote down vote up
@Test
public void renderModelKeyWithJaxbElement() throws Exception {
	String toBeMarshalled = "value";
	String modelKey = "key";
	view.setModelKey(modelKey);
	Map<String, Object> model = new HashMap<>();
	model.put(modelKey, new JAXBElement<>(new QName("model"), String.class, toBeMarshalled));

	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();

	given(marshallerMock.supports(String.class)).willReturn(true);
	marshallerMock.marshal(eq(toBeMarshalled), isA(StreamResult.class));

	view.render(model, request, response);
	assertEquals("Invalid content type", "application/xml", response.getContentType());
	assertEquals("Invalid content length", 0, response.getContentLength());
}
 
Example #6
@Test
public void mavResolver() throws ServletException, IOException {
	initServlet(new ApplicationContextInitializer<GenericWebApplicationContext>() {
		@Override
		public void initialize(GenericWebApplicationContext wac) {
			RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
			ModelAndViewResolver[] mavResolvers = new ModelAndViewResolver[] {new MyModelAndViewResolver()};
			adapterDef.getPropertyValues().add("modelAndViewResolvers", mavResolvers);
			wac.registerBeanDefinition("handlerAdapter", adapterDef);
		}
	}, ModelAndViewResolverController.class);

	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
	MockHttpServletResponse response = new MockHttpServletResponse();
	getServlet().service(request, response);
	assertEquals("myValue", response.getContentAsString());

}
 
Example #7
Source Project: spring4-understanding   Author: langtianya   File: ServletRequestDataBinderTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testFieldDefaultPreemptsFieldMarker() throws Exception {
	TestBean target = new TestBean();
	ServletRequestDataBinder binder = new ServletRequestDataBinder(target);

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addParameter("!postProcessed", "on");
	request.addParameter("_postProcessed", "visible");
	request.addParameter("postProcessed", "on");
	binder.bind(request);
	assertTrue(target.isPostProcessed());

	request.removeParameter("postProcessed");
	binder.bind(request);
	assertTrue(target.isPostProcessed());

	request.removeParameter("!postProcessed");
	binder.bind(request);
	assertFalse(target.isPostProcessed());
}
 
Example #8
Source Project: java-technology-stack   Author: codeEngraver   File: UriComponentsBuilderTests.java    License: MIT License 6 votes vote down vote up
@Test  // SPR-12771
public void fromHttpRequestResetsPortBeforeSettingIt() {
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addHeader("X-Forwarded-Proto", "https");
	request.addHeader("X-Forwarded-Host", "84.198.58.199");
	request.addHeader("X-Forwarded-Port", 443);
	request.setScheme("http");
	request.setServerName("example.com");
	request.setServerPort(80);
	request.setRequestURI("/rest/mobile/users/1");

	HttpRequest httpRequest = new ServletServerHttpRequest(request);
	UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build();

	assertEquals("https", result.getScheme());
	assertEquals("84.198.58.199", result.getHost());
	assertEquals(-1, result.getPort());
	assertEquals("/rest/mobile/users/1", result.getPath());
}
 
Example #9
Source Project: java-technology-stack   Author: codeEngraver   File: AbstractTagTests.java    License: MIT License 6 votes vote down vote up
protected MockPageContext createPageContext() {
	MockServletContext sc = new MockServletContext();
	SimpleWebApplicationContext wac = new SimpleWebApplicationContext();
	wac.setServletContext(sc);
	wac.setNamespace("test");
	wac.refresh();

	MockHttpServletRequest request = new MockHttpServletRequest(sc);
	MockHttpServletResponse response = new MockHttpServletResponse();
	if (inDispatcherServlet()) {
		request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
		LocaleResolver lr = new AcceptHeaderLocaleResolver();
		request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, lr);
		ThemeResolver tr = new FixedThemeResolver();
		request.setAttribute(DispatcherServlet.THEME_RESOLVER_ATTRIBUTE, tr);
		request.setAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE, wac);
	}
	else {
		sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
	}

	return new MockPageContext(sc, request, response);
}
 
Example #10
Source Project: spring-analysis-note   Author: Vip-Augus   File: SessionScopeTests.java    License: MIT License 6 votes vote down vote up
@Test
public void destructionAtSessionTermination() throws Exception {
	MockHttpSession session = new MockHttpSession();
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setSession(session);
	ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);

	RequestContextHolder.setRequestAttributes(requestAttributes);
	String name = "sessionScopedDisposableObject";
	assertNull(session.getAttribute(name));
	DerivedTestBean bean = (DerivedTestBean) this.beanFactory.getBean(name);
	assertEquals(session.getAttribute(name), bean);
	assertSame(bean, this.beanFactory.getBean(name));

	requestAttributes.requestCompleted();
	session.invalidate();
	assertTrue(bean.wasDestroyed());
}
 
Example #11
Source Project: java-technology-stack   Author: codeEngraver   File: RequestLoggingFilterTests.java    License: MIT License 6 votes vote down vote up
@Test
public void payloadReader() throws Exception {
	filter.setIncludePayload(true);

	final MockHttpServletRequest request = new MockHttpServletRequest("POST", "/hotels");
	MockHttpServletResponse response = new MockHttpServletResponse();

	final String requestBody = "Hello World";
	request.setContent(requestBody.getBytes("UTF-8"));

	FilterChain filterChain = new FilterChain() {
		@Override
		public void doFilter(ServletRequest filterRequest, ServletResponse filterResponse)
				throws IOException, ServletException {
			((HttpServletResponse) filterResponse).setStatus(HttpServletResponse.SC_OK);
			String buf = FileCopyUtils.copyToString(filterRequest.getReader());
			assertEquals(requestBody, buf);
		}
	};

	filter.doFilter(request, response, filterChain);

	assertNotNull(filter.afterRequestMessage);
	assertTrue(filter.afterRequestMessage.contains(requestBody));
}
 
Example #12
Source Project: spring4-understanding   Author: langtianya   File: MarshallingViewTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void renderModelKey() throws Exception {
	Object toBeMarshalled = new Object();
	String modelKey = "key";
	view.setModelKey(modelKey);
	Map<String, Object> model = new HashMap<String, Object>();
	model.put(modelKey, toBeMarshalled);

	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();

	given(marshallerMock.supports(Object.class)).willReturn(true);
	marshallerMock.marshal(eq(toBeMarshalled), isA(StreamResult.class));

	view.render(model, request, response);
	assertEquals("Invalid content type", "application/xml", response.getContentType());
	assertEquals("Invalid content length", 0, response.getContentLength());
}
 
Example #13
Source Project: spring4-understanding   Author: langtianya   File: ResponseBodyEmitterReturnValueHandlerTests.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {

	List<HttpMessageConverter<?>> converters = Arrays.asList(
			new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter());

	this.handler = new ResponseBodyEmitterReturnValueHandler(converters);
	this.mavContainer = new ModelAndViewContainer();

	this.request = new MockHttpServletRequest();
	this.response = new MockHttpServletResponse();
	this.webRequest = new ServletWebRequest(this.request, this.response);

	AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response);
	WebAsyncUtils.getAsyncManager(this.webRequest).setAsyncWebRequest(asyncWebRequest);
	this.request.setAsyncSupported(true);
}
 
Example #14
Source Project: spring4-understanding   Author: langtianya   File: RequestScopeTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void circleLeadsToException() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest();
	RequestAttributes requestAttributes = new ServletRequestAttributes(request);
	RequestContextHolder.setRequestAttributes(requestAttributes);

	try {
		String name = "requestScopedObjectCircle1";
		assertNull(request.getAttribute(name));

		this.beanFactory.getBean(name);
		fail("Should have thrown BeanCreationException");
	}
	catch (BeanCreationException ex) {
		assertTrue(ex.contains(BeanCurrentlyInCreationException.class));
	}
}
 
Example #15
Source Project: java-technology-stack   Author: codeEngraver   File: AtomFeedViewTests.java    License: MIT License 6 votes vote down vote up
@Test
public void render() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();

	Map<String, String> model = new LinkedHashMap<>();
	model.put("2", "This is entry 2");
	model.put("1", "This is entry 1");

	view.render(model, request, response);
	assertEquals("Invalid content-type", "application/atom+xml", response.getContentType());
	String expected = "<feed xmlns=\"http://www.w3.org/2005/Atom\">" + "<title>Test Feed</title>" +
			"<entry><title>2</title><summary>This is entry 2</summary></entry>" +
			"<entry><title>1</title><summary>This is entry 1</summary></entry>" + "</feed>";
	assertThat(response.getContentAsString(), isSimilarTo(expected));
}
 
Example #16
Source Project: spring4-understanding   Author: langtianya   File: ShallowEtagHeaderFilterTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void filterSendError() throws Exception {
	final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hotels");
	MockHttpServletResponse response = new MockHttpServletResponse();

	final byte[] responseBody = "Hello World".getBytes("UTF-8");
	FilterChain filterChain = (filterRequest, filterResponse) -> {
		assertEquals("Invalid request passed", request, filterRequest);
		response.setContentLength(100);
		FileCopyUtils.copy(responseBody, filterResponse.getOutputStream());
		((HttpServletResponse) filterResponse).sendError(HttpServletResponse.SC_FORBIDDEN);
	};
	filter.doFilter(request, response, filterChain);

	assertEquals("Invalid status", 403, response.getStatus());
	assertNull("Invalid ETag header", response.getHeader("ETag"));
	assertEquals("Invalid Content-Length header", 100, response.getContentLength());
	assertArrayEquals("Invalid content", responseBody, response.getContentAsByteArray());
}
 
Example #17
Source Project: spring4-understanding   Author: langtianya   File: RequestPartMethodArgumentResolverTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void resolvePartArrayArgument() throws Exception {
	MockPart part1 = new MockPart("requestPart1", "Hello World 1".getBytes());
	MockPart part2 = new MockPart("requestPart2", "Hello World 2".getBytes());
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setMethod("POST");
	request.setContentType("multipart/form-data");
	request.addPart(part1);
	request.addPart(part2);
	webRequest = new ServletWebRequest(request);

	Object result = resolver.resolveArgument(paramPartArray, null, webRequest, null);

	assertTrue(result instanceof Part[]);
	Part[] parts = (Part[]) result;
	assertThat(parts, Matchers.arrayWithSize(2));
	assertEquals(parts[0], part1);
	assertEquals(parts[1], part2);
}
 
Example #18
@Test
public void optionalParamMissing() throws Exception {
	initServletWithControllers(OptionalParamController.class);

	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath.do");
	MockHttpServletResponse response = new MockHttpServletResponse();
	getServlet().service(request, response);
	assertEquals("null-false-null", response.getContentAsString());
}
 
Example #19
Source Project: spring4-understanding   Author: langtianya   File: CookieLocaleResolverTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResolveLocaleWithoutCookie() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addPreferredLocale(Locale.TAIWAN);

	CookieLocaleResolver resolver = new CookieLocaleResolver();

	Locale loc = resolver.resolveLocale(request);
	assertEquals(request.getLocale(), loc);
}
 
Example #20
Source Project: spring-analysis-note   Author: Vip-Augus   File: ModelFactoryOrderingTests.java    License: MIT License 5 votes vote down vote up
@Before
public void setup() {
	this.sessionAttributeStore = new DefaultSessionAttributeStore();
	this.webRequest = new ServletWebRequest(new MockHttpServletRequest(), new MockHttpServletResponse());
	this.mavContainer = new ModelAndViewContainer();
	this.mavContainer.addAttribute("methods", new ArrayList<String>());
}
 
Example #21
Source Project: java-technology-stack   Author: codeEngraver   File: ServletAnnotationControllerHandlerMethodTests.java    License: MIT License 5 votes vote down vote up
@Test
public void bindingCookieValue() throws Exception {
	initServletWithControllers(BindingCookieValueController.class);

	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/test");
	request.setCookies(new Cookie("date", "2008-11-18"));
	MockHttpServletResponse response = new MockHttpServletResponse();
	getServlet().service(request, response);
	assertEquals("test-2008", response.getContentAsString());
}
 
Example #22
Source Project: spring-analysis-note   Author: Vip-Augus   File: ParamsRequestConditionTests.java    License: MIT License 5 votes vote down vote up
@Test
public void paramValueNoMatch() {
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addParameter("foo", "bazz");

	assertNull(new ParamsRequestCondition("foo=bar").getMatchingCondition(request));
}
 
Example #23
Source Project: java-technology-stack   Author: codeEngraver   File: PathMatchingUrlHandlerMappingTests.java    License: MIT License 5 votes vote down vote up
@Test
public void mappingExposedInRequest() throws Exception {
	Object bean = wac.getBean("mainController");
	MockHttpServletRequest req = new MockHttpServletRequest("GET", "/show.html");
	HandlerExecutionChain hec = getHandler(req);
	assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
	assertEquals("Mapping not exposed", "show.html",
			req.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE));
}
 
Example #24
Source Project: spring4-understanding   Author: langtianya   File: SimpleUrlHandlerMappingTests.java    License: Apache License 2.0 5 votes vote down vote up
private HandlerExecutionChain getHandler(HandlerMapping hm, MockHttpServletRequest req) throws Exception {
	HandlerExecutionChain hec = hm.getHandler(req);
	HandlerInterceptor[] interceptors = hec.getInterceptors();
	if (interceptors != null) {
		for (HandlerInterceptor interceptor : interceptors) {
			interceptor.preHandle(req, null, hec.getHandler());
		}
	}
	return hec;
}
 
Example #25
Source Project: java-technology-stack   Author: codeEngraver   File: RequestMappingInfoTests.java    License: MIT License 5 votes vote down vote up
@Test
public void matchConsumesCondition() {
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
	request.setContentType("text/plain");

	RequestMappingInfo info = paths("/foo").consumes("text/plain").build();
	RequestMappingInfo match = info.getMatchingCondition(request);

	assertNotNull(match);

	info = paths("/foo").consumes("application/xml").build();
	match = info.getMatchingCondition(request);

	assertNull(match);
}
 
Example #26
Source Project: java-technology-stack   Author: codeEngraver   File: SessionLocaleResolverTests.java    License: MIT License 5 votes vote down vote up
@Test
public void testResolveLocaleWithoutSession() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addPreferredLocale(Locale.TAIWAN);

	SessionLocaleResolver resolver = new SessionLocaleResolver();

	assertEquals(request.getLocale(), resolver.resolveLocale(request));
}
 
Example #27
Source Project: spring4-understanding   Author: langtianya   File: ServletAnnotationMappingUtilsTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void checkParametersSimpleMatch() {
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
	request.addParameter("param1", "value1");
	String[] params = new String[]{"param1", "!param2"};
	boolean result = ServletAnnotationMappingUtils.checkParameters(params, request);
	assertTrue("Invalid request method result", result);
}
 
Example #28
Source Project: spring-analysis-note   Author: Vip-Augus   File: FlashMapManagerTests.java    License: MIT License 5 votes vote down vote up
@Test
public void saveOutputFlashMapDecodeParameters() throws Exception {

	FlashMap flashMap = new FlashMap();
	flashMap.put("key", "value");
	flashMap.setTargetRequestPath("/path");
	flashMap.addTargetRequestParam("param", "%D0%90%D0%90");
	flashMap.addTargetRequestParam("param", "%D0%91%D0%91");
	flashMap.addTargetRequestParam("param", "%D0%92%D0%92");
	flashMap.addTargetRequestParam("%3A%2F%3F%23%5B%5D%40", "value");

	this.request.setCharacterEncoding("UTF-8");
	this.flashMapManager.saveOutputFlashMap(flashMap, this.request, this.response);

	MockHttpServletRequest requestAfterRedirect = new MockHttpServletRequest("GET", "/path");
	requestAfterRedirect.setQueryString(
			"param=%D0%90%D0%90&param=%D0%91%D0%91&param=%D0%92%D0%92&%3A%2F%3F%23%5B%5D%40=value");
	requestAfterRedirect.addParameter("param", "\u0410\u0410");
	requestAfterRedirect.addParameter("param", "\u0411\u0411");
	requestAfterRedirect.addParameter("param", "\u0412\u0412");
	requestAfterRedirect.addParameter(":/?#[]@", "value");

	flashMap = this.flashMapManager.retrieveAndUpdate(requestAfterRedirect, new MockHttpServletResponse());
	assertNotNull(flashMap);
	assertEquals(1, flashMap.size());
	assertEquals("value", flashMap.get("key"));
}
 
Example #29
Source Project: java-technology-stack   Author: codeEngraver   File: ResponseBodyEmitterReturnValueHandlerTests.java    License: MIT License 5 votes vote down vote up
@Before
public void setup() throws Exception {

	List<HttpMessageConverter<?>> converters = Arrays.asList(
			new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter());

	this.handler = new ResponseBodyEmitterReturnValueHandler(converters);
	this.request = new MockHttpServletRequest();
	this.response = new MockHttpServletResponse();
	this.webRequest = new ServletWebRequest(this.request, this.response);

	AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response);
	WebAsyncUtils.getAsyncManager(this.webRequest).setAsyncWebRequest(asyncWebRequest);
	this.request.setAsyncSupported(true);
}
 
Example #30
Source Project: spring-analysis-note   Author: Vip-Augus   File: HeadersRequestConditionTests.java    License: MIT License 5 votes vote down vote up
@Test
public void headerValueMatchNegated() {
	HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.addHeader("foo", "baz");

	assertNotNull(condition.getMatchingCondition(request));
}