|
|
|
@ -18,6 +18,7 @@ package org.springframework.web.reactive.result.condition; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import org.jspecify.annotations.Nullable; |
|
|
|
import org.jspecify.annotations.Nullable; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
@ -159,6 +160,15 @@ public class VersionRequestConditionTests { |
|
|
|
condition.handleMatch(exchange); |
|
|
|
condition.handleMatch(exchange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
void compareWithoutRequestVersion() { |
|
|
|
|
|
|
|
VersionRequestCondition condition = Stream.of(condition("1.1"), condition("1.2"), emptyCondition()) |
|
|
|
|
|
|
|
.min((c1, c2) -> c1.compareTo(c2, exchange())) |
|
|
|
|
|
|
|
.get(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(condition).isEqualTo(emptyCondition()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private VersionRequestCondition condition(String v) { |
|
|
|
private VersionRequestCondition condition(String v) { |
|
|
|
this.strategy.addSupportedVersion(v.endsWith("+") ? v.substring(0, v.length() - 1) : v); |
|
|
|
this.strategy.addSupportedVersion(v.endsWith("+") ? v.substring(0, v.length() - 1) : v); |
|
|
|
return new VersionRequestCondition(v, this.strategy); |
|
|
|
return new VersionRequestCondition(v, this.strategy); |
|
|
|
|