Browse Source

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

See gh-47263
pull/47415/head
Moritz Halbritter 4 months ago
parent
commit
489336255a
  1. 8
      module/spring-boot-ldap/build.gradle
  2. 8
      module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java

8
module/spring-boot-ldap/build.gradle

@ -51,3 +51,11 @@ dependencies { @@ -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"
}

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

@ -26,6 +26,7 @@ import com.unboundid.ldap.sdk.BindResult; @@ -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 { @@ -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();
});
}

Loading…
Cancel
Save