Use noNullElements

Collection#contains(null) does not work for all collection types

Issue gh-10703
This commit is contained in:
Josh Cummings
2022-01-14 14:32:12 -07:00
parent e20449a542
commit b2fe9149cf
6 changed files with 18 additions and 3 deletions

View File

@@ -43,6 +43,11 @@ public class MediaTypeServerWebExchangeMatcherTests {
assertThatIllegalArgumentException().isThrownBy(() -> new MediaTypeServerWebExchangeMatcher(types));
}
@Test
public void constructorListOfDoesNotThrowNullPointerException() {
new MediaTypeServerWebExchangeMatcher(List.of(MediaType.ALL));
}
@Test
public void constructorMediaTypeArrayWhenContainsNullThenThrowsIllegalArgumentException() {
MediaType[] types = { null };

View File

@@ -55,6 +55,11 @@ public class AndRequestMatcherTests {
assertThatNullPointerException().isThrownBy(() -> new AndRequestMatcher((RequestMatcher[]) null));
}
@Test
public void constructorListOfDoesNotThrowNullPointer() {
new AndRequestMatcher(List.of(new AntPathRequestMatcher("/test")));
}
@Test
public void constructorArrayContainsNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new AndRequestMatcher((RequestMatcher) null));

View File

@@ -55,6 +55,11 @@ public class OrRequestMatcherTests {
assertThatNullPointerException().isThrownBy(() -> new OrRequestMatcher((RequestMatcher[]) null));
}
@Test
public void constructorListOfDoesNotThrowNullPointer() {
new OrRequestMatcher(List.of(new AntPathRequestMatcher("/test")));
}
@Test
public void constructorArrayContainsNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new OrRequestMatcher((RequestMatcher) null));