From 05e940692a19cd876c48ee61e2707d067def7a6a Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Mon, 15 Oct 2018 11:41:24 -0600 Subject: [PATCH] Polish UnboundIdContainerTests Basic startup test now confirms successful startup instead of asserting on startup failure. Issue: gh-5920 --- .../ldap/server/UnboundIdContainerTests.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java index 7a5231d183..dcba728cd1 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java @@ -22,8 +22,9 @@ import java.util.List; import org.junit.Test; +import org.springframework.context.support.GenericApplicationContext; + import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; /** * @author EddĂș MelĂ©ndez @@ -31,17 +32,18 @@ import static org.junit.Assert.fail; public class UnboundIdContainerTests { @Test - public void startLdapServer() throws IOException { + public void startLdapServer() throws Exception { UnboundIdContainer server = new UnboundIdContainer("dc=springframework,dc=org", "classpath:test-server.ldif"); + server.setApplicationContext(new GenericApplicationContext()); List ports = getDefaultPorts(1); server.setPort(ports.get(0)); try { server.afterPropertiesSet(); - fail("Expected a RuntimeException to be thrown."); - } catch (Exception ex) { - assertThat(ex).hasMessage("Server startup failed"); + assertThat(server.getPort()).isEqualTo(ports.get(0)); + } finally { + server.destroy(); } }