metadataResolver = new TestMetadataResolver();
MetadataRepository repo = mock( MetadataRepository.class );
RepositorySession repositorySession = mock( RepositorySession.class );
when( repositorySession.getResolver() ).thenReturn( metadataResolver );
when( repositorySession.getRepository() ).thenReturn( repo );
TestRepositorySessionFactory repositorySessionFactory =
applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
repositorySessionFactory.setRepositorySession( repositorySession );
RepositoryContentFactory factory = mock( RepositoryContentFactory.class );
action.setRepositoryFactory( factory );