use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerPresent.
@Test
public void headerPresent() {
HeadersRequestCondition condition = new HeadersRequestCondition("accept");
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Accept", "");
assertNotNull(condition.getMatchingCondition(request));
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueNoMatch.
@Test
public void headerValueNoMatch() {
HeadersRequestCondition condition = new HeadersRequestCondition("foo=bar");
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("foo", "bazz");
assertNull(condition.getMatchingCondition(request));
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method compareTo.
@Test
public void compareTo() {
MockHttpServletRequest request = new MockHttpServletRequest();
HeadersRequestCondition condition1 = new HeadersRequestCondition("foo", "bar", "baz");
HeadersRequestCondition condition2 = new HeadersRequestCondition("foo", "bar");
int result = condition1.compareTo(condition2, request);
assertTrue("Invalid comparison result: " + result, result < 0);
result = condition2.compareTo(condition1, request);
assertTrue("Invalid comparison result: " + result, result > 0);
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueMatchNegated.
@Test
public void headerValueMatchNegated() {
HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("foo", "baz");
assertNotNull(condition.getMatchingCondition(request));
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueNoMatchNegated.
@Test
public void headerValueNoMatchNegated() {
HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("foo", "bar");
assertNull(condition.getMatchingCondition(request));
}
Aggregations