Skip to content

Commit d97539b

Browse files
committed
Add nullability annotations to tests in module/spring-boot-data-couchbase-test
See gh-47263
1 parent 8c25063 commit d97539b

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

module/spring-boot-data-couchbase-test/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ dependencies {
3939
dockerTestImplementation("org.testcontainers:junit-jupiter")
4040
dockerTestImplementation("org.testcontainers:testcontainers")
4141

42+
dockerTestCompileOnly("com.google.code.findbugs:jsr305")
43+
4244
testImplementation(project(":test-support:spring-boot-test-support"))
4345

4446
testRuntimeOnly("ch.qos.logback:logback-classic")
@@ -47,3 +49,7 @@ dependencies {
4749
tasks.named("compileTestJava") {
4850
options.nullability.checking = "tests"
4951
}
52+
53+
tasks.named("compileDockerTestJava") {
54+
options.nullability.checking = "tests"
55+
}

module/spring-boot-data-couchbase-test/src/dockerTest/java/org/springframework/boot/data/couchbase/test/autoconfigure/DataCouchbaseTestReactiveIntegrationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void testRepository() {
6565
ExampleDocument document = new ExampleDocument();
6666
document.setText("Look, new @DataCouchbaseTest!");
6767
document = this.exampleReactiveRepository.save(document).block(Duration.ofSeconds(30));
68+
assertThat(document).isNotNull();
6869
assertThat(document.getId()).isNotNull();
6970
assertThat(this.couchbaseTemplate.getBucketName()).isEqualTo(BUCKET_NAME);
7071
this.exampleReactiveRepository.deleteAll();

module/spring-boot-data-couchbase-test/src/dockerTest/java/org/springframework/boot/data/couchbase/test/autoconfigure/ExampleDocument.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.data.couchbase.test.autoconfigure;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.data.annotation.Id;
2022
import org.springframework.data.couchbase.core.mapping.Document;
2123
import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
@@ -31,9 +33,10 @@ public class ExampleDocument {
3133

3234
@Id
3335
@GeneratedValue(strategy = GenerationStrategy.UNIQUE)
36+
@SuppressWarnings("NullAway.Init")
3437
private String id;
3538

36-
private String text;
39+
private @Nullable String text;
3740

3841
public String getId() {
3942
return this.id;
@@ -43,11 +46,11 @@ public void setId(String id) {
4346
this.id = id;
4447
}
4548

46-
public String getText() {
49+
public @Nullable String getText() {
4750
return this.text;
4851
}
4952

50-
public void setText(String text) {
53+
public void setText(@Nullable String text) {
5154
this.text = text;
5255
}
5356

0 commit comments

Comments
 (0)