AsahSegmentsEntryCache { public long[] getSegmentsEntryIds(String userId) { return _portalCache.get(_generateCacheKey(userId)); }  long[] getSegmentsEntryIds(String userId); void putSegmentsEntryIds(String userId, long[] segmentsEntryIds);  }
@Test public void testGetSegmentsEntryIds() { String userId = RandomTestUtil.randomString(); long[] segmentsEntryIds = { RandomTestUtil.randomLong(), RandomTestUtil.randomLong() }; String cacheKey = _generateCacheKey(userId); Mockito.when( _portalCache.get(cacheKey) ).thenReturn( segmentsEntryIds ); Assert.assertArrayEquals( segmentsEntryIds, _asahSegmentsEntryCache.getSegmentsEntryIds(userId)); Mockito.verify( _portalCache, Mockito.times(1) ).get( Mockito.eq(cacheKey) ); }