Program: 47753
Project: 47753
Buggy source:
private void testListSplitBrain(boolean multicast) throws InterruptedException {
  String name=randomString();
  Config config=getConfig(multicast);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(config);
  IList<Object> list=h1.getList(name);
  TestMemberShipListener memberShipListener=new TestMemberShipListener(2);
  h3.getCluster().addMembershipListener(memberShipListener);
  TestLifeCycleListener lifeCycleListener=new TestLifeCycleListener(1);
  h3.getLifecycleService().addLifecycleListener(lifeCycleListener);
  for (int i=0; i < 100; i++) {
    list.add("String_Node_Str" + i);
  }
  assertSizeEventually(100,list);
  closeConnectionBetween(h1,h3);
  closeConnectionBetween(h2,h3);
  assertTrue(memberShipListener.splitLatch.await(10,TimeUnit.SECONDS));
  assertEquals(2,h1.getCluster().getMembers().size());
  assertEquals(2,h2.getCluster().getMembers().size());
  assertEquals(1,h3.getCluster().getMembers().size());
  for (int i=100; i < 200; i++) {
    list.add("String_Node_Str" + i);
  }
  assertSizeEventually(200,list);
  IList<Object> list3=h3.getList(name);
  for (int i=0; i < 50; i++) {
    list3.add("String_Node_Str" + i);
  }
  assertTrue(lifeCycleListener.mergeLatch.await(60,TimeUnit.SECONDS));
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  IList<Object> testList=h1.getList(name);
  assertFalse(testList.contains("String_Node_Str"));
  assertFalse(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
}

Fixed version (ground truth):
private void testListSplitBrain(boolean multicast) throws InterruptedException {
  String name=randomString();
  Config config=getConfig(multicast);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(config);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(config);
  IList<Object> list=h1.getList(name);
  TestMemberShipListener memberShipListener=new TestMemberShipListener(2);
  h3.getCluster().addMembershipListener(memberShipListener);
  TestLifeCycleListener lifeCycleListener=new TestLifeCycleListener(1);
  h3.getLifecycleService().addLifecycleListener(lifeCycleListener);
  for (int i=0; i < 100; i++) {
    list.add("String_Node_Str" + i);
  }
  assertSizeEventually(100,list);
  waitAllForSafeState();
  closeConnectionBetween(h1,h3);
  closeConnectionBetween(h2,h3);
  assertTrue(memberShipListener.splitLatch.await(10,TimeUnit.SECONDS));
  assertEquals(2,h1.getCluster().getMembers().size());
  assertEquals(2,h2.getCluster().getMembers().size());
  assertEquals(1,h3.getCluster().getMembers().size());
  for (int i=100; i < 200; i++) {
    list.add("String_Node_Str" + i);
  }
  assertSizeEventually(200,list);
  IList<Object> list3=h3.getList(name);
  for (int i=0; i < 50; i++) {
    list3.add("String_Node_Str" + i);
  }
  assertTrue(lifeCycleListener.mergeLatch.await(60,TimeUnit.SECONDS));
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  IList<Object> testList=h1.getList(name);
  assertFalse(testList.contains("String_Node_Str"));
  assertFalse(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
  assertTrue(testList.contains("String_Node_Str"));
}