Improve nullability of TestPropertyValues

Closes gh-50269
This commit is contained in:
Andy Wilkinson
2026-05-01 08:39:18 +01:00
parent da2a62f32f
commit 065c463cef
@@ -100,7 +100,7 @@ public final class TestPropertyValues {
* @since 2.4.0
*/
public TestPropertyValues and(@Nullable Map<String, String> map) {
return (map != null) ? and(map.entrySet().stream(), Pair::fromMapEntry) : this;
return (map != null) ? and(map.entrySet().stream(), Pair::fromNonNullValueMapEntry) : this;
}
/**
@@ -257,7 +257,7 @@ public final class TestPropertyValues {
* @return the new instance
*/
public static TestPropertyValues of(@Nullable Map<String, String> map) {
return (map != null) ? of(map.entrySet().stream(), Pair::fromMapEntry) : empty();
return (map != null) ? of(map.entrySet().stream(), Pair::fromNonNullValueMapEntry) : empty();
}
/**
@@ -363,6 +363,10 @@ public final class TestPropertyValues {
return of(entry.getKey(), entry.getValue());
}
private static Pair fromNonNullValueMapEntry(Map.Entry<String, String> entry) {
return of(entry.getKey(), entry.getValue());
}
/**
* Factory method to create a {@link Pair} from a name and value.
* @param name the name