Add nullability annotations to tests in module/spring-boot-ldap

See gh-47263
This commit is contained in:
Moritz Halbritter 2025-10-06 12:28:30 +02:00
parent fde0ae4ac9
commit 489336255a
2 changed files with 13 additions and 3 deletions

View File

@ -51,3 +51,11 @@ dependencies {
testRuntimeOnly("ch.qos.logback:logback-classic")
testRuntimeOnly("org.apache.commons:commons-pool2")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}
tasks.named("compileDockerTestJava") {
options.nullability.checking = "tests"
}

View File

@ -26,6 +26,7 @@ import com.unboundid.ldap.sdk.BindResult;
import com.unboundid.ldap.sdk.DN;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.schema.Schema;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
@ -173,9 +174,10 @@ class EmbeddedLdapAutoConfigurationTests {
"spring.ldap.embedded.base-dn:dc=spring,dc=org")
.run((context) -> {
InMemoryDirectoryServer server = context.getBean(InMemoryDirectoryServer.class);
assertThat(server.getSchema().getObjectClass("exampleAuxiliaryClass")).isNotNull();
assertThat(server.getSchema().getAttributeType("exampleAttributeName")).isNotNull();
Schema schema = server.getSchema();
assertThat(schema).isNotNull();
assertThat(schema.getObjectClass("exampleAuxiliaryClass")).isNotNull();
assertThat(schema.getAttributeType("exampleAttributeName")).isNotNull();
});
}