Add nullability annotations to tests in module/spring-boot-data-couchbase-test
See gh-47263
This commit is contained in:
parent
8c25063273
commit
d97539bc46
|
@ -39,6 +39,8 @@ dependencies {
|
|||
dockerTestImplementation("org.testcontainers:junit-jupiter")
|
||||
dockerTestImplementation("org.testcontainers:testcontainers")
|
||||
|
||||
dockerTestCompileOnly("com.google.code.findbugs:jsr305")
|
||||
|
||||
testImplementation(project(":test-support:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
|
@ -47,3 +49,7 @@ dependencies {
|
|||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
||||
tasks.named("compileDockerTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class DataCouchbaseTestReactiveIntegrationTests {
|
|||
ExampleDocument document = new ExampleDocument();
|
||||
document.setText("Look, new @DataCouchbaseTest!");
|
||||
document = this.exampleReactiveRepository.save(document).block(Duration.ofSeconds(30));
|
||||
assertThat(document).isNotNull();
|
||||
assertThat(document.getId()).isNotNull();
|
||||
assertThat(this.couchbaseTemplate.getBucketName()).isEqualTo(BUCKET_NAME);
|
||||
this.exampleReactiveRepository.deleteAll();
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.boot.data.couchbase.test.autoconfigure;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.couchbase.core.mapping.Document;
|
||||
import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
|
||||
|
@ -31,9 +33,10 @@ public class ExampleDocument {
|
|||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationStrategy.UNIQUE)
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
private String id;
|
||||
|
||||
private String text;
|
||||
private @Nullable String text;
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
|
@ -43,11 +46,11 @@ public class ExampleDocument {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
public @Nullable String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
public void setText(@Nullable String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue