如何在 Junit5 中设置嵌入式 ApacheDS

Fab*_*ich 6 ldap apacheds junit5

在关于在 Junit 测试中嵌入 ApacheDS 服务器的 ApacheDS 文档中,他们只提到了 Junit4 使用的示例

@RunWith(FrameworkRunner.class)
Run Code Online (Sandbox Code Playgroud)

或者

@ClassRule
public static CreateLdapServerRule serverRule = new CreateLdapServerRule();
Run Code Online (Sandbox Code Playgroud)

RunWithClassRule在 Junit5 中不可用。

如何使用嵌入式 ApacheDS LdapServer 运行 Junit5 测试?

小智 0

使用 apacheds-test-framework >= 2.0.0.AM27 您可以使用

@ExtendWith(ApacheDSTestExtension.class)
Run Code Online (Sandbox Code Playgroud)