Mocking Cache Manage for Active Objects Test

I am creating a test for Active Objects. My service implementation depends on Active Object and CacheManage objects as shown below.

    @Before
    public void setUp() throws Exception {
        assertNotNull(entityManager);

        ao = new TestActiveObjects(entityManager);
        projectService = new ProjectServiceImpl(ao, cacheManager);  //how to initialize?
    }

How do I create test for such service implementation? My service methods depends on cache. Is there any mock cache manager available?

Just ran into this issue today.

You can use the com.atlassian.cache.memory.MemoryCacheManager class as a drop in CacheManager for your tests.

Just add the relevant import to your pom:

    <dependency>
      <groupId>com.atlassian.cache</groupId>
      <artifactId>atlassian-cache-memory</artifactId>
      <version>${cache-version}</version>
      <scope>test</scope>
    </dependency>