@Test
  @ClientCompatibleTest
  public void apply() {
    HazelcastInstance hazelcastInstance = createHazelcastInstance();
    IAtomicReference<String> ref = hazelcastInstance.getAtomicReference("apply");

    assertEquals("null", ref.apply(new AppendFunction("")));
    assertEquals(null, ref.get());

    ref.set("foo");
    assertEquals("foobar", ref.apply(new AppendFunction("bar")));
    assertEquals("foo", ref.get());

    assertEquals(null, ref.apply(new NullFunction()));
    assertEquals("foo", ref.get());
  }
  @Test(expected = IllegalArgumentException.class)
  @ClientCompatibleTest
  public void apply_whenCalledWithNullFunction() {
    HazelcastInstance hazelcastInstance = createHazelcastInstance();
    IAtomicReference<String> ref =
        hazelcastInstance.getAtomicReference("apply_whenCalledWithNullFunction");

    ref.apply(null);
  }
  @Test
  @ClientCompatibleTest
  public void apply_whenException() {
    HazelcastInstance hazelcastInstance = createHazelcastInstance();
    IAtomicReference<String> ref = hazelcastInstance.getAtomicReference("apply");
    ref.set("foo");

    try {
      ref.apply(new FailingFunction());
      fail();
    } catch (WoohaaException expected) {
    }

    assertEquals("foo", ref.get());
  }