mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
codacy: Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes.
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
d4379f3c89
commit
7ad8e304e2
@ -28,12 +28,14 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to register and notify CallParticipantModel.Observers.
|
* Helper class to register and notify CallParticipantModel.Observers.
|
||||||
*
|
* <p>
|
||||||
* This class is only meant for internal use by CallParticipantModel; observers must register themselves against a
|
* This class is only meant for internal use by CallParticipantModel; observers must register themselves against a
|
||||||
* CallParticipantModel rather than against a CallParticipantModelNotifier.
|
* CallParticipantModel rather than against a CallParticipantModelNotifier.
|
||||||
*/
|
*/
|
||||||
class CallParticipantModelNotifier {
|
class CallParticipantModelNotifier {
|
||||||
|
|
||||||
|
private final List<CallParticipantModelObserverOn> callParticipantModelObserversOn = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to associate a CallParticipantModel.Observer with a Handler.
|
* Helper class to associate a CallParticipantModel.Observer with a Handler.
|
||||||
*/
|
*/
|
||||||
@ -47,8 +49,6 @@ class CallParticipantModelNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CallParticipantModelObserverOn> callParticipantModelObserversOn = new ArrayList<>();
|
|
||||||
|
|
||||||
public synchronized void addObserver(CallParticipantModel.Observer observer, Handler handler) {
|
public synchronized void addObserver(CallParticipantModel.Observer observer, Handler handler) {
|
||||||
if (observer == null) {
|
if (observer == null) {
|
||||||
throw new IllegalArgumentException("CallParticipantModel.Observer can not be null");
|
throw new IllegalArgumentException("CallParticipantModel.Observer can not be null");
|
||||||
|
@ -25,12 +25,14 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to register and notify CallParticipantMessageListeners.
|
* Helper class to register and notify CallParticipantMessageListeners.
|
||||||
*
|
* <p>
|
||||||
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
|
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
|
||||||
* a SignalingMessageReceiver rather than against a CallParticipantMessageNotifier.
|
* a SignalingMessageReceiver rather than against a CallParticipantMessageNotifier.
|
||||||
*/
|
*/
|
||||||
class CallParticipantMessageNotifier {
|
class CallParticipantMessageNotifier {
|
||||||
|
|
||||||
|
private final List<CallParticipantMessageListenerFrom> callParticipantMessageListenersFrom = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to associate a CallParticipantMessageListener with a session ID.
|
* Helper class to associate a CallParticipantMessageListener with a session ID.
|
||||||
*/
|
*/
|
||||||
@ -45,8 +47,6 @@ class CallParticipantMessageNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CallParticipantMessageListenerFrom> callParticipantMessageListenersFrom = new ArrayList<>();
|
|
||||||
|
|
||||||
public synchronized void addListener(SignalingMessageReceiver.CallParticipantMessageListener listener, String sessionId) {
|
public synchronized void addListener(SignalingMessageReceiver.CallParticipantMessageListener listener, String sessionId) {
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
throw new IllegalArgumentException("CallParticipantMessageListener can not be null");
|
throw new IllegalArgumentException("CallParticipantMessageListener can not be null");
|
||||||
|
@ -25,12 +25,14 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to register and notify WebRtcMessageListeners.
|
* Helper class to register and notify WebRtcMessageListeners.
|
||||||
*
|
* <p>
|
||||||
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
|
* This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
|
||||||
* a SignalingMessageReceiver rather than against a WebRtcMessageNotifier.
|
* a SignalingMessageReceiver rather than against a WebRtcMessageNotifier.
|
||||||
*/
|
*/
|
||||||
class WebRtcMessageNotifier {
|
class WebRtcMessageNotifier {
|
||||||
|
|
||||||
|
private final List<WebRtcMessageListenerFrom> webRtcMessageListenersFrom = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to associate a WebRtcMessageListener with a session ID and room type.
|
* Helper class to associate a WebRtcMessageListener with a session ID and room type.
|
||||||
*/
|
*/
|
||||||
@ -48,8 +50,6 @@ class WebRtcMessageNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<WebRtcMessageListenerFrom> webRtcMessageListenersFrom = new ArrayList<>();
|
|
||||||
|
|
||||||
public synchronized void addListener(SignalingMessageReceiver.WebRtcMessageListener listener, String sessionId, String roomType) {
|
public synchronized void addListener(SignalingMessageReceiver.WebRtcMessageListener listener, String sessionId, String roomType) {
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
throw new IllegalArgumentException("WebRtcMessageListener can not be null");
|
throw new IllegalArgumentException("WebRtcMessageListener can not be null");
|
||||||
|
@ -66,6 +66,15 @@ public class CallParticipantListExternalSignalingTest {
|
|||||||
private Collection<Participant> expectedLeft;
|
private Collection<Participant> expectedLeft;
|
||||||
private Collection<Participant> expectedUnchanged;
|
private Collection<Participant> expectedUnchanged;
|
||||||
|
|
||||||
|
// 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<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
|
||||||
|
Collections.sort(left, Comparator.comparing(Participant::getSessionId));
|
||||||
|
return expectedLeft.equals(left);
|
||||||
|
};
|
||||||
|
|
||||||
private static class ParticipantsUpdateParticipantBuilder {
|
private static class ParticipantsUpdateParticipantBuilder {
|
||||||
private Participant newUser(long inCall, long lastPing, String sessionId, Participant.ParticipantType type,
|
private Participant newUser(long inCall, long lastPing, String sessionId, Participant.ParticipantType type,
|
||||||
String userId) {
|
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<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
|
|
||||||
Collections.sort(left, Comparator.comparing(Participant::getSessionId));
|
|
||||||
return expectedLeft.equals(left);
|
|
||||||
};
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
|
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
|
||||||
|
@ -58,6 +58,15 @@ public class CallParticipantListInternalSignalingTest {
|
|||||||
private Collection<Participant> expectedLeft;
|
private Collection<Participant> expectedLeft;
|
||||||
private Collection<Participant> expectedUnchanged;
|
private Collection<Participant> expectedUnchanged;
|
||||||
|
|
||||||
|
// 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<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
|
||||||
|
Collections.sort(left, Comparator.comparing(Participant::getSessionId));
|
||||||
|
return expectedLeft.equals(left);
|
||||||
|
};
|
||||||
|
|
||||||
private static class UsersInRoomParticipantBuilder {
|
private static class UsersInRoomParticipantBuilder {
|
||||||
private Participant newUser(long inCall, long lastPing, String sessionId, String userId) {
|
private Participant newUser(long inCall, long lastPing, String sessionId, String userId) {
|
||||||
Participant participant = new Participant();
|
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<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
|
|
||||||
Collections.sort(left, Comparator.comparing(Participant::getSessionId));
|
|
||||||
return expectedLeft.equals(left);
|
|
||||||
};
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
|
SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
|
||||||
@ -529,7 +529,9 @@ public class CallParticipantListInternalSignalingTest {
|
|||||||
// Last ping is not seen as changed, even if it did.
|
// Last ping is not seen as changed, even if it did.
|
||||||
expectedUnchanged.add(builder.newUser(IN_CALL | WITH_AUDIO, 42, "theSessionId9", "theUserId9"));
|
expectedUnchanged.add(builder.newUser(IN_CALL | WITH_AUDIO, 42, "theSessionId9", "theUserId9"));
|
||||||
|
|
||||||
verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined), eq(expectedUpdated),
|
verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined),
|
||||||
argThat(matchesExpectedLeftIgnoringOrder), eq(expectedUnchanged));
|
eq(expectedUpdated),
|
||||||
|
argThat(matchesExpectedLeftIgnoringOrder),
|
||||||
|
eq(expectedUnchanged));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user