@Test
 public void testCoalesceNotificationsSet() {
   InvalidateCacheNotificationCoalescer coalescer = new InvalidateCacheNotificationCoalescer();
   ICacheEntryFilter<Object, Object> filter1 =
       new KeyCacheEntryFilter<Object, Object>(
           CollectionUtility.<Object>arrayList(CodeType1.class));
   ICacheEntryFilter<Object, Object> filter2 =
       new KeyCacheEntryFilter<Object, Object>(
           CollectionUtility.<Object>arrayList(CodeType2.class));
   List<InvalidateCacheNotification> testList =
       CollectionUtility.arrayList(
           new InvalidateCacheNotification(CACHE_ID_1, filter1),
           new InvalidateCacheNotification(CACHE_ID_1, filter2),
           new InvalidateCacheNotification(CACHE_ID_2, filter2),
           new InvalidateCacheNotification(CACHE_ID_3, new AllCacheEntryFilter<>()),
           new InvalidateCacheNotification(CACHE_ID_3, filter2));
   List<InvalidateCacheNotification> res = coalescer.coalesce(testList);
   assertEquals(3, res.size());
   for (InvalidateCacheNotification notification : res) {
     if (CACHE_ID_1.equals(notification.getCacheId())) {
       Set<?> keys = ((KeyCacheEntryFilter<?, ?>) notification.getFilter()).getKeys();
       assertEquals(2, keys.size());
       assertTrue(keys.contains(CodeType1.class));
       assertTrue(keys.contains(CodeType2.class));
     } else if (CACHE_ID_2.equals(notification.getCacheId())) {
       Set<?> keys = ((KeyCacheEntryFilter<?, ?>) notification.getFilter()).getKeys();
       assertEquals(1, keys.size());
       assertTrue(keys.contains(CodeType2.class));
     } else if (CACHE_ID_3.equals(notification.getCacheId())) {
       assertTrue(notification.getFilter() instanceof AllCacheEntryFilter);
     } else {
       fail("invalid cacheId" + notification.getCacheId());
     }
   }
 }
 @Test
 public void testCoalesceEmptySet() {
   InvalidateCacheNotificationCoalescer coalescer = new InvalidateCacheNotificationCoalescer();
   List<InvalidateCacheNotification> res =
       coalescer.coalesce(new ArrayList<InvalidateCacheNotification>());
   assertTrue(res.isEmpty());
 }