AccessKeyUtil { public List<String> findAvailableSecret(String appId) { return accessKeyServiceWithCache.getAvailableSecrets(appId); } AccessKeyUtil(AccessKeyServiceWithCache accessKeyServiceWithCache); List<String> findAvailableSecret(String appId); String extractAppIdFromRequest(HttpServletRequest request); String buildSignature(String path, String query, String timestampString, String secret);  }
@Test public void testFindAvailableSecret() { String appId = "someAppId"; List<String> returnSecrets = Lists.newArrayList("someSecret"); when(accessKeyServiceWithCache.getAvailableSecrets(appId)).thenReturn(returnSecrets); List<String> availableSecret = accessKeyUtil.findAvailableSecret(appId); assertThat(availableSecret).containsExactly("someSecret"); verify(accessKeyServiceWithCache).getAvailableSecrets(appId); }