### Question:
AbstractCachingAuthenticator extends AbstractAuthenticator<Principal> { protected void cachePrincipal(String apiKey, Principal principal) { cache.put(apiKey, Optional.fromNullable(principal)); } protected  AbstractCachingAuthenticator(long allowedTimestampSlop, long cacheTimeout, TimeUnit timeUnit, long maxCacheElements);   }### Answer:
@Test public void testPrecache() { Authenticator unit = new Authenticator(300, 20); unit.cachePrincipal(aCredentials.getApiKey(), new SimplePrincipal("a")); unit.cachePrincipal(bCredentials.getApiKey(), new SimplePrincipal("b")); unit.authenticate(aCredentials); unit.authenticate(bCredentials); assertEquals(0, unit.getNumLoads()); }