Ejemplo n.º 1
0
 @Test(expected = UnsupportedOperationException.class)
 public void testBulkComputeIfAbsentThrowsForGenericFunction() throws Exception {
   Function<
           Iterable<? extends Long>,
           Iterable<? extends Map.Entry<? extends Long, ? extends String>>>
       mappingFunction = mock(Function.class);
   store.bulkComputeIfAbsent(new HashSet<Long>(Arrays.asList(1L, 2L)), mappingFunction);
 }
Ejemplo n.º 2
0
  @Test
  public void testBulkComputeIfAbsentGetAll() throws Exception {
    store.put(1L, "one");
    store.put(2L, "two");
    Ehcache.GetAllFunction<Long, String> getAllAllFunction =
        new Ehcache.GetAllFunction<Long, String>();
    Map<Long, Store.ValueHolder<String>> valueHolderMap =
        store.bulkComputeIfAbsent(new HashSet<Long>(Arrays.asList(1L, 2L)), getAllAllFunction);

    assertThat(valueHolderMap.get(1L).value(), is("one"));
    assertThat(store.get(1L).value(), is("one"));
    assertThat(valueHolderMap.get(2L).value(), is("two"));
    assertThat(store.get(2L).value(), is("two"));
  }