mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Improve nullability of TestPropertyValues
Closes gh-50269
This commit is contained in:
+6
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user