mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-08 22:18:34 +00:00
Fix flakey robolectric test.
This commit is contained in:
parent
a574fe026c
commit
1f1fc94d22
@ -358,11 +358,11 @@ dependencies {
|
|||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
testImplementation 'org.mockito:mockito-core:1.9.5'
|
testImplementation 'org.mockito:mockito-core:2.8.9'
|
||||||
testImplementation 'org.powermock:powermock-api-mockito:1.6.5'
|
testImplementation 'org.powermock:powermock-api-mockito2:1.7.4'
|
||||||
testImplementation 'org.powermock:powermock-module-junit4:1.6.5'
|
testImplementation 'org.powermock:powermock-module-junit4:1.7.4'
|
||||||
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.5'
|
testImplementation 'org.powermock:powermock-module-junit4-rule:1.7.4'
|
||||||
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.5'
|
testImplementation 'org.powermock:powermock-classloading-xstream:1.7.4'
|
||||||
|
|
||||||
testImplementation 'androidx.test:core:1.2.0'
|
testImplementation 'androidx.test:core:1.2.0'
|
||||||
testImplementation ('org.robolectric:robolectric:4.2') {
|
testImplementation ('org.robolectric:robolectric:4.2') {
|
||||||
@ -455,3 +455,13 @@ def getLastCommitTimestamp() {
|
|||||||
return os.toString() + "000"
|
return os.toString() + "000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(Test) {
|
||||||
|
testLogging {
|
||||||
|
events "failed"
|
||||||
|
exceptionFormat "full"
|
||||||
|
showCauses true
|
||||||
|
showExceptions true
|
||||||
|
showStackTraces true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.thoughtcrime.securesms.conversationlist;
|
package org.thoughtcrime.securesms.conversationlist;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -33,8 +33,8 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
@Config(manifest = Config.NONE, application = Application.class)
|
@Config(manifest = Config.NONE, application = Application.class)
|
||||||
@PowerMockIgnore({ "org.powermock.*", "org.mockito.*", "org.robolectric.*", "android.*", "androidx.*" })
|
@PowerMockIgnore({ "org.mockito.*", "org.robolectric.*", "android.*", "androidx.*" })
|
||||||
@PrepareForTest({ApplicationDependencies.class, DatabaseFactory.class, ThreadDatabase.class})
|
@PrepareForTest({ ApplicationDependencies.class, DatabaseFactory.class })
|
||||||
public class UnarchivedConversationListDataSourceTest {
|
public class UnarchivedConversationListDataSourceTest {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
@ -49,14 +49,11 @@ public class UnarchivedConversationListDataSourceTest {
|
|||||||
mockStatic(ApplicationDependencies.class);
|
mockStatic(ApplicationDependencies.class);
|
||||||
mockStatic(DatabaseFactory.class);
|
mockStatic(DatabaseFactory.class);
|
||||||
|
|
||||||
final Context context = mock(Context.class);
|
|
||||||
final ContentResolver contentResolver = mock(ContentResolver.class);
|
|
||||||
threadDatabase = mock(ThreadDatabase.class);
|
threadDatabase = mock(ThreadDatabase.class);
|
||||||
|
|
||||||
when(DatabaseFactory.getThreadDatabase(any())).thenReturn(threadDatabase);
|
when(DatabaseFactory.getThreadDatabase(any())).thenReturn(threadDatabase);
|
||||||
when(context.getContentResolver()).thenReturn(contentResolver);
|
|
||||||
|
|
||||||
testSubject = new ConversationListDataSource.UnarchivedConversationListDataSource(context, mock(Invalidator.class));
|
testSubject = new ConversationListDataSource.UnarchivedConversationListDataSource(ApplicationProvider.getApplicationContext(), mock(Invalidator.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user