summaryrefslogtreecommitdiffstats
path: root/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java')
-rw-r--r--infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
index 74aef67d0..dfdcd089b 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
+++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
@@ -80,7 +80,7 @@ public class DumpCacheManagerTest {
@Test
public void testCaching() throws ReadFailedException {
final IpDetailsReplyDump stage1Data = new IpDetailsReplyDump();
- final String key = cacheKeyFactory.createKey(identifier);
+ final String key = cacheKeyFactory.createKey(identifier, NO_PARAMS);
// executor cant return null data
@@ -134,14 +134,14 @@ public class DumpCacheManagerTest {
@Test
public void testSameKeyDifferentTypes() throws ReadFailedException {
final DumpCacheManager<String, Void> stringManager =
- new DumpCacheManager.DumpCacheManagerBuilder<String, Void>()
- .withExecutor((InstanceIdentifier, Void) -> "value")
- .acceptOnly(String.class)
- .build();
+ new DumpCacheManager.DumpCacheManagerBuilder<String, Void>()
+ .withExecutor((InstanceIdentifier, Void) -> "value")
+ .acceptOnly(String.class)
+ .build();
final DumpCacheManager<Integer, Void> intManager = new DumpCacheManager.DumpCacheManagerBuilder<Integer, Void>()
- .acceptOnly(Integer.class)
- .withExecutor((InstanceIdentifier, Void) -> 3).build();
+ .acceptOnly(Integer.class)
+ .withExecutor((InstanceIdentifier, Void) -> 3).build();
final Optional<String> stringDump = stringManager.getDump(identifier, cache, NO_PARAMS);
final Optional<Integer> integerDump = intManager.getDump(identifier, cache, NO_PARAMS);
@@ -153,6 +153,21 @@ public class DumpCacheManagerTest {
}
+ @Test
+ public void testCachingWithDifferentParams() throws ReadFailedException {
+ final DumpCacheManager<Integer, Integer> manager =
+ new DumpCacheManager.DumpCacheManagerBuilder<Integer, Integer>()
+ .withExecutor((iid, param) -> param)
+ .acceptOnly(Integer.class)
+ .build();
+
+ final Optional<Integer> dump1 = manager.getDump(identifier, cache, 1);
+ final Optional<Integer> dump2 = manager.getDump(identifier, cache, 2);
+
+ assertEquals(1, dump1.get().intValue());
+ assertEquals(2, dump2.get().intValue());
+ }
+
private EntityDumpPostProcessingFunction<IpDetailsReplyDump> createPostProcessor() {
return ipDetailsReplyDump -> {
IpDetailsReplyDump modified = new IpDetailsReplyDump();