Skip to content

Commit 4893362

Browse files
committed
Add nullability annotations to tests in module/spring-boot-ldap
See gh-47263
1 parent fde0ae4 commit 4893362

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

module/spring-boot-ldap/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ dependencies {
5151
testRuntimeOnly("ch.qos.logback:logback-classic")
5252
testRuntimeOnly("org.apache.commons:commons-pool2")
5353
}
54+
55+
tasks.named("compileTestJava") {
56+
options.nullability.checking = "tests"
57+
}
58+
59+
tasks.named("compileDockerTestJava") {
60+
options.nullability.checking = "tests"
61+
}

module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.unboundid.ldap.sdk.DN;
2727
import com.unboundid.ldap.sdk.LDAPConnection;
2828
import com.unboundid.ldap.sdk.LDAPException;
29+
import com.unboundid.ldap.sdk.schema.Schema;
2930
import org.junit.jupiter.api.Test;
3031

3132
import org.springframework.beans.factory.annotation.Value;
@@ -173,9 +174,10 @@ void testCustomSchemaValidation() {
173174
"spring.ldap.embedded.base-dn:dc=spring,dc=org")
174175
.run((context) -> {
175176
InMemoryDirectoryServer server = context.getBean(InMemoryDirectoryServer.class);
176-
177-
assertThat(server.getSchema().getObjectClass("exampleAuxiliaryClass")).isNotNull();
178-
assertThat(server.getSchema().getAttributeType("exampleAttributeName")).isNotNull();
177+
Schema schema = server.getSchema();
178+
assertThat(schema).isNotNull();
179+
assertThat(schema.getObjectClass("exampleAuxiliaryClass")).isNotNull();
180+
assertThat(schema.getAttributeType("exampleAttributeName")).isNotNull();
179181
});
180182
}
181183

0 commit comments

Comments
 (0)