### Question:
CredentialsCacheBean { @GET @Path("/{dn}/evict") @Produces({"text/plain"}) @JmxManaged public String evict(@PathParam("dn") String dn) { String result = "Evicted " + dn + " from the credentials cache."; if (!cachedDatawaveUserServiceInstance.isUnsatisfied()) { result = cachedDatawaveUserServiceInstance.get().evictMatching(dn); } authManager.getCachedKeys().parallelStream() .filter(p -> p instanceof DatawavePrincipal) .filter(p -> ((DatawavePrincipal) p).getProxiedUsers().stream().anyMatch(u -> u.getName().equals(dn))) .forEach(p -> { log.debug("Evicting {} from the Wildfly authentication cache.", p); authManager.flushCache(p); }); return result; }  @GET @Path("/flushAll") @JmxManaged String flushAll(); @GET @Path("/{dn}/evict") @Produces({"text/plain"}) @JmxManaged String evict(@PathParam("dn") String dn); @GET @Path("/listDNs") @Produces({"text/plain", "application/xml", "text/xml", "application/json", "text/html"}) @JmxManaged DnList listDNs(@QueryParam("localOnly") boolean localOnly); @GET @Path("/listMatching") @Produces({"text/plain", "application/xml", "text/xml", "application/json", "text/html"}) @JmxManaged DnList listDNsMatching(@QueryParam("substring") final String substr); @GET @Path("/{dn}/list") @Produces({"text/plain", "application/xml", "text/xml", "application/json", "text/html"}) @JmxManaged DatawaveUser list(@PathParam("dn") String dn); @SuppressWarnings("unused") @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) // transactions not supported directly by this bean void onConfigurationUpdate(@Observes ConfigurationEvent event); @SuppressWarnings("unused") @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) void onRefreshComplete(@Observes RefreshLifecycle refreshLifecycle); @GET @Path("/listAccumuloAuths") @Produces({"text/plain", "application/json"}) @JmxManaged Set<String> getAccumuloUserAuths(); @GET @Path("/reloadAccumuloAuths") @Produces({"application/xml", "text/xml", "application/json"}) GenericResponse<String> reloadAccumuloAuthorizations();  }### Answer:
@Test public void testEvict() throws Exception { Principal expected = cache.asMap().keySet().stream().filter(p -> p.getName().startsWith("user2")).findFirst().orElse(null); assertNotNull(expected); assertEquals(3, cache.size()); ccb.evict("user2<issuer2>"); assertNull(cache.getIfPresent(expected)); assertEquals(2, cache.size()); }