Program: 49924
Project: 49924
Buggy source:
@Test public void testUpdateMembers() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  Cluster cluster=mock(Cluster.class);
  when(client.getCluster()).thenReturn(cluster);
  Set<Member> members=new HashSet<Member>();
  Member member1=mock(Member.class);
  Member member2=mock(Member.class);
  Member member3=mock(Member.class);
  InetSocketAddress inetSocketAddress1=new InetSocketAddress("String_Node_Str",9701);
  InetSocketAddress inetSocketAddress2=new InetSocketAddress("String_Node_Str",9702);
  InetSocketAddress inetSocketAddress3=new InetSocketAddress("String_Node_Str",9703);
  when(member1.getInetSocketAddress()).thenReturn(inetSocketAddress1);
  when(member2.getInetSocketAddress()).thenReturn(inetSocketAddress2);
  when(member3.getInetSocketAddress()).thenReturn(inetSocketAddress3);
  members.add(member1);
  members.add(member2);
  members.add(member3);
  when(cluster.getMembers()).thenReturn(members);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.updateMembers();
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress1));
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress2));
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress3));
  assertFalse(connectionManager.getClusterMembers().contains(inetSocketAddress));
  assertEquals(3,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testUpdateMembers() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  Cluster cluster=mock(Cluster.class);
  when(client.getCluster()).thenReturn(cluster);
  Set<Member> members=new HashSet<Member>();
  Member member1=mock(Member.class);
  Member member2=mock(Member.class);
  Member member3=mock(Member.class);
  InetSocketAddress inetSocketAddress1=new InetSocketAddress("String_Node_Str",9701);
  InetSocketAddress inetSocketAddress2=new InetSocketAddress("String_Node_Str",9702);
  InetSocketAddress inetSocketAddress3=new InetSocketAddress("String_Node_Str",9703);
  when(member1.getInetSocketAddress()).thenReturn(inetSocketAddress1);
  when(member2.getInetSocketAddress()).thenReturn(inetSocketAddress2);
  when(member3.getInetSocketAddress()).thenReturn(inetSocketAddress3);
  members.add(member1);
  members.add(member2);
  members.add(member3);
  when(cluster.getMembers()).thenReturn(members);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.updateMembers();
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress1));
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress2));
  assertTrue(connectionManager.getClusterMembers().contains(inetSocketAddress3));
  assertFalse(connectionManager.getClusterMembers().contains(inetSocketAddress));
  assertEquals(3,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}