use of org.springframework.web.testfixture.server.MockServerWebExchange in project spring-framework by spring-projects.
the class HandlerResultHandlerTests method noConcreteMediaType.
// SPR-12894
@Test
void noConcreteMediaType() {
List<MediaType> producible = Collections.singletonList(ALL);
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/path"));
MediaType actual = this.resultHandler.selectMediaType(exchange, () -> producible);
assertThat(actual).isEqualTo(APPLICATION_OCTET_STREAM);
}
use of org.springframework.web.testfixture.server.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueMatch.
@Test
public void headerValueMatch() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/").header("foo", "bar"));
HeadersRequestCondition condition = new HeadersRequestCondition("foo=bar");
assertThat(condition.getMatchingCondition(exchange)).isNotNull();
}
use of org.springframework.web.testfixture.server.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueNoMatch.
@Test
public void headerValueNoMatch() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/").header("foo", "bazz"));
HeadersRequestCondition condition = new HeadersRequestCondition("foo=bar");
assertThat(condition.getMatchingCondition(exchange)).isNull();
}
use of org.springframework.web.testfixture.server.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueNoMatchNegated.
@Test
public void headerValueNoMatchNegated() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/").header("foo", "bar"));
HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
assertThat(condition.getMatchingCondition(exchange)).isNull();
}
use of org.springframework.web.testfixture.server.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerNotPresent.
@Test
public void headerNotPresent() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/"));
HeadersRequestCondition condition = new HeadersRequestCondition("!accept");
assertThat(condition.getMatchingCondition(exchange)).isNotNull();
}
Aggregations