Add nullability annotations to tests in module/spring-boot-micrometer-metrics-test

See gh-47263
This commit is contained in:
Moritz Halbritter
2025-10-13 13:44:07 +02:00
parent 11d50ae293
commit 54b663eb69
2 changed files with 9 additions and 1 deletions
@@ -35,3 +35,7 @@ dependencies {
testRuntimeOnly("ch.qos.logback:logback-classic")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}
@@ -24,8 +24,11 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.MergedContextConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link AutoConfigureMetrics} and {@link MetricsContextCustomizerFactory}
@@ -131,7 +134,8 @@ class MetricsContextCustomizerFactoryTests {
}
private void applyCustomizerToContext(ContextCustomizer customizer, ConfigurableApplicationContext context) {
customizer.customizeContext(context, null);
customizer.customizeContext(context,
new MergedContextConfiguration(getClass(), null, null, null, mock(ContextLoader.class)));
}
private ContextCustomizer createContextCustomizer(Class<?> testClass) {