Junit test case for RepositoryJob

Hi All,

I trying to write test case for RepositoryJob. However I am unable to mock ‘Session’ from ‘RepositoryJobExecutionContext’. Can someone please help on how to proceed on that? Requesting any example code snippet if possible.


Add the following dependencies, and use org.onehippo.repository.mock.MockSession.


For example,

final MockNode root = MockNode.root();
final MockSession session = new MockSession(root);
final Map<String, String> attributes = new HashMap<>();
final RepositoryJobExecutionContext context = new RepositoryJobExecutionContext(session, attributes) {
    public Session createSession(Credentials credentials) throws LoginException, RepositoryException {
        return session;
// ...