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

    assertNull(ref.getAndAlter(new NullFunction()));
    assertEquals(null, ref.get());

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

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

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

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

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