use of io.scalecube.cluster.membership.MemberStatus in project scalecube by scalecube.
the class FailureDetectorTest method assertStatus.
/**
* @param address target member to expect on
* @param status expected listen status
* @param events events collection of failure detector events
* @param expected expected members of the given listenStatus
*/
private void assertStatus(Address address, MemberStatus status, Collection<FailureDetectorEvent> events, Address... expected) {
List<Address> actual = events.stream().filter(event -> event.status() == status).map(FailureDetectorEvent::member).map(Member::address).collect(Collectors.toList());
String msg1 = String.format("Node %s expected %s %s members %s, but was: %s", address, expected.length, status, Arrays.toString(expected), events);
assertEquals(msg1, expected.length, actual.size());
for (Address member : expected) {
String msg2 = String.format("Node %s expected as %s %s, but was: %s", address, status, member, events);
assertTrue(msg2, actual.contains(member));
}
}
Aggregations