mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 08:09:12 +01:00
Live group update messages on conversation list and conversation.
This commit is contained in:
committed by
Greyson Parrelli
parent
7446c2096d
commit
bd1c164d57
@@ -0,0 +1,30 @@
|
||||
package org.thoughtcrime.securesms.testutil;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.powermock.api.mockito.PowerMockito.doCallRealMethod;
|
||||
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
||||
|
||||
public final class MainThreadUtil {
|
||||
|
||||
private MainThreadUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes {@link Util}'s Main thread assertions pass or fail during tests.
|
||||
* <p>
|
||||
* Use with {@link org.powermock.modules.junit4.PowerMockRunner} or robolectric with powermock
|
||||
* rule and {@code @PrepareForTest(Util.class)}
|
||||
*/
|
||||
public static void setMainThread(boolean isMainThread) {
|
||||
mockStatic(Util.class);
|
||||
when(Util.isMainThread()).thenReturn(isMainThread);
|
||||
try {
|
||||
doCallRealMethod().when(Util.class, "assertMainThread");
|
||||
doCallRealMethod().when(Util.class, "assertNotMainThread");
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user