JCR Unit provides a JUnit 4 rule and JUnit 5 extension for use when testing code that depends on a Java Content Repository 2.0 implementation. It creates an in-memory content repository using the Jackrabbit Oak implementation.
The current release only supports file (nt:file
) and folder (nt:folder
) node types.
In JUni
class RepositoryTest {
@Rule
public JCRRepositoryRule repositoryRule = JCRRepositoryRule.withCredentials("root", "secret".toCharArray()); // (1)
@Test
public void checkSomething() {
// ...
}
}
LDAPUnit has been published in [Maven Central](http://search.maven.org) at the following coordinates:
<dependency>
<groupId>com.buraolotech.oss.jcrunit</groupId>
<artifactId>jcrunit</artifactId>
<version>3.0.0</version>
</dependency>
Internally JCRUnit is using the Jackrabbit Oak to run the in-memory content repository.
The JCRUnit is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/jcrunit.