mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-23 01:39:02 +00:00
Add nullability annotations to tests in module/spring-boot-hibernate
See gh-47263
This commit is contained in:
@@ -54,3 +54,7 @@ dependencies {
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
testRuntimeOnly("com.h2database:h2")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
||||
+3
-1
@@ -1086,7 +1086,9 @@ class HibernateJpaAutoConfigurationTests {
|
||||
properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE);
|
||||
factoryBean.setJpaPropertyMap(properties);
|
||||
factoryBean.afterPropertiesSet();
|
||||
return factoryBean.getObject();
|
||||
EntityManagerFactory bean = factoryBean.getObject();
|
||||
assertThat(bean).isNotNull();
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
+1
@@ -56,6 +56,7 @@ class HibernatePropertiesTests {
|
||||
.withUserConfiguration(TestConfiguration.class);
|
||||
|
||||
@Mock
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private Supplier<String> ddlAutoSupplier;
|
||||
|
||||
@Test
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
|
||||
@@ -181,7 +182,7 @@ class HibernateMetricsAutoConfigurationTests {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
private @Nullable Long id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user