AsahInterestTermCache { public String[] getInterestTerms(String userId) { return _portalCache.get(_generateCacheKey(userId)); }  String[] getInterestTerms(String userId); void putInterestTerms(String userId, String[] terms);  }
@Test public void testGetInterestTerms() { String userId = RandomTestUtil.randomString(); String[] interestTerms = { RandomTestUtil.randomString(), RandomTestUtil.randomString() }; String cacheKey = _generateCacheKey(userId); Mockito.when( _portalCache.get(cacheKey) ).thenReturn( interestTerms ); Assert.assertArrayEquals( interestTerms, _asahInterestTermCache.getInterestTerms(userId)); Mockito.verify( _portalCache, Mockito.times(1) ).get( Mockito.eq(cacheKey) ); }