use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ConsumesRequestConditionTests method compareToSingle.
@Test
public void compareToSingle() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
ConsumesRequestCondition condition1 = new ConsumesRequestCondition("text/plain");
ConsumesRequestCondition condition2 = new ConsumesRequestCondition("text/*");
int result = condition1.compareTo(condition2, exchange);
assertTrue("Invalid comparison result: " + result, result < 0);
result = condition2.compareTo(condition1, exchange);
assertTrue("Invalid comparison result: " + result, result > 0);
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ConsumesRequestConditionTests method getMatchingCondition.
@Test
public void getMatchingCondition() throws Exception {
MockServerWebExchange exchange = postExchange("text/plain");
ConsumesRequestCondition condition = new ConsumesRequestCondition("text/plain", "application/xml");
ConsumesRequestCondition result = condition.getMatchingCondition(exchange);
assertConditions(result, "text/plain");
condition = new ConsumesRequestCondition("application/xml");
result = condition.getMatchingCondition(exchange);
assertNull(result);
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ConsumesRequestConditionTests method consumesMatch.
@Test
public void consumesMatch() throws Exception {
MockServerWebExchange exchange = postExchange("text/plain");
ConsumesRequestCondition condition = new ConsumesRequestCondition("text/plain");
assertNotNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ConsumesRequestConditionTests method consumesSingleNoMatch.
@Test
public void consumesSingleNoMatch() throws Exception {
MockServerWebExchange exchange = postExchange("application/xml");
ConsumesRequestCondition condition = new ConsumesRequestCondition("text/plain");
assertNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ConsumesRequestConditionTests method consumesParseError.
@Test
public void consumesParseError() throws Exception {
MockServerWebExchange exchange = postExchange("01");
ConsumesRequestCondition condition = new ConsumesRequestCondition("text/plain");
assertNull(condition.getMatchingCondition(exchange));
}
Aggregations