lukecwik commented on a change in pull request #16252:
URL: https://github.com/apache/beam/pull/16252#discussion_r770953260



##########
File path: 
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/CachesTest.java
##########
@@ -33,32 +34,53 @@
 @RunWith(JUnit4.class)
 public class CachesTest {
   @Test
-  public void testNoopCache() {
+  public void testNoopCache() throws Exception {
     Cache<String, String> cache = Caches.noop();
     cache.put("key", "value");
     assertNull(cache.peek("key"));
     assertEquals("value", cache.computeIfAbsent("key", (unused) -> "value"));
     assertNull(cache.peek("key"));
-    assertThat(cache.keys(), is(emptyIterable()));
   }
 
   @Test
-  public void testEternalCache() {
+  public void testShrinkableIsShrunk() throws Exception {
+    Shrinkable<Object> shrinkable =
+        new Shrinkable<Object>() {
+
+          @Override
+          public Object shrink() {
+            return "wasShrunk";
+          }
+        };
+
+    Cache<Object, Object> cache =
+        Caches.forCache(new 
ShrinkOnEviction(CacheBuilder.newBuilder().maximumSize(1)).getCache());

Review comment:
       There isn't a way to make the ShrinkOnEviction have a final field 
storing a reference to the cache that I know of.
   
   forCache is still package private, I'll mark it as @VisibleForTesting in a 
follow-up PR.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to