Improve health contributor null support
Update `NamedContributorsMapAdapter` to check for `null` keys or values during construction. Also update `HealthEndpointSupport` to allow null component entries. See gh-18687
This commit is contained in:
@@ -48,6 +48,22 @@ class NamedContributorsMapAdapterTests {
|
||||
.withMessage("ValueAdapter must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createWhenMapContainsNullValueThrowsException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new TestNamedContributorsMapAdapter<>(Collections.singletonMap("test", null),
|
||||
Function.identity()))
|
||||
.withMessage("Map must not contain null values");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createWhenMapContainsNullKeyThrowsException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new TestNamedContributorsMapAdapter<>(Collections.singletonMap(null, "test"),
|
||||
Function.identity()))
|
||||
.withMessage("Map must not contain null keys");
|
||||
}
|
||||
|
||||
@Test
|
||||
void iterateReturnsAdaptedEntries() {
|
||||
TestNamedContributorsMapAdapter<String> adapter = createAdapter();
|
||||
|
||||
Reference in New Issue
Block a user