assertFalse(result);
}
@Test
public void testRemoveMigrationListener() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance hz1 = factory.newHazelcastInstance();
PartitionService partitionService = hz1.getPartitionService();
MigrationListener listener = mock(MigrationListener.class);
String id = partitionService.addMigrationListener(listener);
boolean removed = partitionService.removeMigrationListener(id);
assertTrue(removed);
// now we add a member
HazelcastInstance hz2 = factory.newHazelcastInstance();
warmUpPartitions(hz1, hz2);
// and verify that the listener isn't called.
verify(listener, never()).migrationStarted(any(MigrationEvent.class));
}