diff --git a/app/src/main/java/com/nextcloud/talk/call/CallParticipantModelNotifier.java b/app/src/main/java/com/nextcloud/talk/call/CallParticipantModelNotifier.java index e0b6904fc..8452a157c 100644 --- a/app/src/main/java/com/nextcloud/talk/call/CallParticipantModelNotifier.java +++ b/app/src/main/java/com/nextcloud/talk/call/CallParticipantModelNotifier.java @@ -28,12 +28,14 @@ import java.util.List; /** * Helper class to register and notify CallParticipantModel.Observers. - * + *
* This class is only meant for internal use by CallParticipantModel; observers must register themselves against a
* CallParticipantModel rather than against a CallParticipantModelNotifier.
*/
class CallParticipantModelNotifier {
+ private final List
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
* a SignalingMessageReceiver rather than against a CallParticipantMessageNotifier.
*/
class CallParticipantMessageNotifier {
+ private final List
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
* a SignalingMessageReceiver rather than against a WebRtcMessageNotifier.
*/
class WebRtcMessageNotifier {
+ private final List> matchesExpectedLeftIgnoringOrder = left -> {
+ Collections.sort(left, Comparator.comparing(Participant::getSessionId));
+ return expectedLeft.equals(left);
+ };
+
private static class ParticipantsUpdateParticipantBuilder {
private Participant newUser(long inCall, long lastPing, String sessionId, Participant.ParticipantType type,
String userId) {
@@ -90,15 +99,6 @@ public class CallParticipantListExternalSignalingTest {
}
}
- // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
- // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
- // expectedLeft).
- // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
- private final ArgumentMatcher
> matchesExpectedLeftIgnoringOrder = left -> {
- Collections.sort(left, Comparator.comparing(Participant::getSessionId));
- return expectedLeft.equals(left);
- };
-
@Before
public void setUp() {
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
diff --git a/app/src/test/java/com/nextcloud/talk/call/CallParticipantListInternalSignalingTest.java b/app/src/test/java/com/nextcloud/talk/call/CallParticipantListInternalSignalingTest.java
index c0198fc0a..15403ecf8 100644
--- a/app/src/test/java/com/nextcloud/talk/call/CallParticipantListInternalSignalingTest.java
+++ b/app/src/test/java/com/nextcloud/talk/call/CallParticipantListInternalSignalingTest.java
@@ -58,6 +58,15 @@ public class CallParticipantListInternalSignalingTest {
private Collection
> matchesExpectedLeftIgnoringOrder = left -> {
+ Collections.sort(left, Comparator.comparing(Participant::getSessionId));
+ return expectedLeft.equals(left);
+ };
+
private static class UsersInRoomParticipantBuilder {
private Participant newUser(long inCall, long lastPing, String sessionId, String userId) {
Participant participant = new Participant();
@@ -79,15 +88,6 @@ public class CallParticipantListInternalSignalingTest {
}
}
- // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
- // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
- // expectedLeft).
- // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
- private final ArgumentMatcher
> matchesExpectedLeftIgnoringOrder = left -> {
- Collections.sort(left, Comparator.comparing(Participant::getSessionId));
- return expectedLeft.equals(left);
- };
-
@Before
public void setUp() {
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
@@ -529,7 +529,9 @@ public class CallParticipantListInternalSignalingTest {
// Last ping is not seen as changed, even if it did.
expectedUnchanged.add(builder.newUser(IN_CALL | WITH_AUDIO, 42, "theSessionId9", "theUserId9"));
- verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined), eq(expectedUpdated),
- argThat(matchesExpectedLeftIgnoringOrder), eq(expectedUnchanged));
+ verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined),
+ eq(expectedUpdated),
+ argThat(matchesExpectedLeftIgnoringOrder),
+ eq(expectedUnchanged));
}
}