Add nullability annotations to tests in core/spring-boot-properties-migrator
See gh-47263
This commit is contained in:
parent
ea05f6df15
commit
532ea9abc1
|
@ -35,3 +35,7 @@ tasks.named("javadoc").configure {
|
|||
// No public or protected classes
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.boot.context.properties.migrator;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
@ -36,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
@ExtendWith(OutputCaptureExtension.class)
|
||||
class PropertiesMigrationListenerTests {
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
private @Nullable ConfigurableApplicationContext context;
|
||||
|
||||
@AfterEach
|
||||
void closeContext() {
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
|
||||
|
@ -230,12 +231,13 @@ class PropertiesMigrationReporterTests {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Origin getOrigin(PropertySource<?> propertySource, String name) {
|
||||
private @Nullable Origin getOrigin(PropertySource<?> propertySource, String name) {
|
||||
return ((OriginLookup<String>) propertySource).getOrigin(name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertMappedProperty(PropertySource<?> propertySource, String name, Object value, Origin origin) {
|
||||
private void assertMappedProperty(PropertySource<?> propertySource, String name, Object value,
|
||||
@Nullable Origin origin) {
|
||||
assertThat(propertySource.containsProperty(name)).isTrue();
|
||||
assertThat(propertySource.getProperty(name)).isEqualTo(value);
|
||||
if (origin != null) {
|
||||
|
@ -269,11 +271,11 @@ class PropertiesMigrationReporterTests {
|
|||
}
|
||||
}
|
||||
|
||||
private String createWarningReport(ConfigurationMetadataRepository repository) {
|
||||
private @Nullable String createWarningReport(ConfigurationMetadataRepository repository) {
|
||||
return createAnalyzer(repository).getReport().getWarningReport();
|
||||
}
|
||||
|
||||
private String createErrorReport(ConfigurationMetadataRepository repository) {
|
||||
private @Nullable String createErrorReport(ConfigurationMetadataRepository repository) {
|
||||
return createAnalyzer(repository).getReport().getErrorReport();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue