Add nullability annotations to tests in module/spring-boot-data-jpa-test
See gh-47263
This commit is contained in:
parent
3353090bc6
commit
2edd8f9d62
|
@ -38,3 +38,7 @@ dependencies {
|
|||
testRuntimeOnly("com.h2database:h2")
|
||||
testRuntimeOnly("org.hsqldb:hsqldb")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
|
|
@ -67,7 +67,9 @@ class DataJpaTestIntegrationTests {
|
|||
ExampleEntity entity = this.entities.persist(new ExampleEntity("spring", "123"));
|
||||
this.entities.flush();
|
||||
Object id = this.entities.getId(entity);
|
||||
assertThat(id).isNotNull();
|
||||
ExampleEntity found = this.entities.find(ExampleEntity.class, id);
|
||||
assertThat(found).isNotNull();
|
||||
assertThat(found.getName()).isEqualTo("spring");
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,13 @@ public class ExampleEntity {
|
|||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String name;
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String reference;
|
||||
|
||||
protected ExampleEntity() {
|
||||
|
|
Loading…
Reference in New Issue