Skip to content

Commit 4a7de63

Browse files
veyndancopybara-github
authored andcommitted
[GH] Remove RunWith(JUnit4::class)
Omitting `RunWith(JUnit4::class)` will cause JUnit to use its default runner, which is just what `JUnit4` type aliases. See https://github.com/junit-team/junit4/wiki/Test-runners#runwith-annotation. Test: ./gradlew test connectedCheck Bug: 270612487 This is an imported pull request from #559. Resolves #559 Github-Pr-Head-Sha: d9c2977 GitOrigin-RevId: 6825927 Change-Id: Ibb9feb15cf665ba630cfb2f410967835376e20bb
1 parent c33a24a commit 4a7de63

30 files changed

Lines changed: 0 additions & 89 deletions

paging/paging-common/src/test/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ import kotlinx.coroutines.flow.collectLatest
2929
import kotlinx.coroutines.flow.takeWhile
3030
import kotlinx.coroutines.launch
3131
import kotlinx.coroutines.test.runTest
32-
import org.junit.runner.RunWith
33-
import org.junit.runners.JUnit4
3432

3533
/**
3634
* reproduces b/203594733
3735
*/
3836
@OptIn(ExperimentalCoroutinesApi::class)
39-
@RunWith(JUnit4::class)
4037
public class CachedPageEventFlowLeakTest {
4138
private val gcHelper = GarbageCollectionTestHelper()
4239

paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ import kotlinx.coroutines.test.UnconfinedTestDispatcher
4242
import kotlinx.coroutines.test.runCurrent
4343
import kotlinx.coroutines.test.runTest
4444
import kotlinx.coroutines.yield
45-
import org.junit.runner.RunWith
46-
import org.junit.runners.JUnit4
4745

4846
@OptIn(ExperimentalCoroutinesApi::class)
49-
@RunWith(JUnit4::class)
5047
class CachingTest {
5148
private val tracker = ActiveFlowTrackerImpl()
5249

paging/paging-common/src/test/kotlin/androidx/paging/DataSourceTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ package androidx.paging
1818

1919
import androidx.kruth.assertThat
2020
import kotlin.test.Test
21-
import org.junit.runner.RunWith
22-
import org.junit.runners.JUnit4
2321

24-
@RunWith(JUnit4::class)
2522
class DataSourceTest {
2623

2724
@Test

paging/paging-common/src/test/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ import androidx.paging.LoadType.REFRESH
2626
import androidx.paging.PageEvent.Drop
2727
import androidx.paging.PageEvent.StaticList
2828
import kotlin.test.Test
29-
import org.junit.runner.RunWith
30-
import org.junit.runners.JUnit4
3129

32-
@RunWith(JUnit4::class)
3330
class FlattenedPageEventStorageTest {
3431
private val list = FlattenedPageEventStorage<String>()
3532

paging/paging-common/src/test/kotlin/androidx/paging/HeaderFooterTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import kotlinx.coroutines.flow.flowOf
2525
import kotlinx.coroutines.flow.single
2626
import kotlinx.coroutines.test.UnconfinedTestDispatcher
2727
import kotlinx.coroutines.test.runTest
28-
import org.junit.runner.RunWith
29-
import org.junit.runners.JUnit4
3028

3129
/**
3230
* Prepend and append are both Done, so that headers will appear
@@ -37,7 +35,6 @@ private val fullLoadStates = loadStates(
3735
)
3836

3937
@OptIn(ExperimentalCoroutinesApi::class)
40-
@RunWith(JUnit4::class)
4138
class HeaderFooterTest {
4239

4340
private fun <T : Any> PageEvent<T>.toPagingData() = PagingData(

paging/paging-common/src/test/kotlin/androidx/paging/HintHandlerTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ import kotlinx.coroutines.launch
3131
import kotlinx.coroutines.test.UnconfinedTestDispatcher
3232
import kotlinx.coroutines.test.runCurrent
3333
import kotlinx.coroutines.test.runTest
34-
import org.junit.runner.RunWith
35-
import org.junit.runners.JUnit4
3634

37-
@RunWith(JUnit4::class)
3835
@OptIn(ExperimentalCoroutinesApi::class)
3936
class HintHandlerTest {
4037
private val hintHandler = HintHandler()

paging/paging-common/src/test/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import kotlin.test.fail
2626
import kotlinx.coroutines.Dispatchers
2727
import kotlinx.coroutines.ExperimentalCoroutinesApi
2828
import kotlinx.coroutines.test.runTest
29-
import org.junit.runner.RunWith
30-
import org.junit.runners.JUnit4
3129
import org.mockito.ArgumentCaptor
3230
import org.mockito.Mockito.verify
3331
import org.mockito.Mockito.verifyNoMoreInteractions
@@ -36,7 +34,6 @@ import org.mockito.kotlin.mock
3634

3735
@OptIn(ExperimentalCoroutinesApi::class)
3836
@Suppress("DEPRECATION")
39-
@RunWith(JUnit4::class)
4037
class ItemKeyedDataSourceTest {
4138

4239
// ----- STANDARD -----

paging/paging-common/src/test/kotlin/androidx/paging/LegacyPageFetcherTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ import kotlinx.coroutines.GlobalScope
3737
import kotlinx.coroutines.test.StandardTestDispatcher
3838
import kotlinx.coroutines.test.advanceUntilIdle
3939
import kotlinx.coroutines.test.runTest
40-
import org.junit.runner.RunWith
41-
import org.junit.runners.JUnit4
4240

4341
@OptIn(ExperimentalCoroutinesApi::class)
44-
@RunWith(JUnit4::class)
4542
class LegacyPageFetcherTest {
4643
private val testDispatcher = StandardTestDispatcher()
4744
private val data = List(9) { "$it" }

paging/paging-common/src/test/kotlin/androidx/paging/LegacyPagingSourceTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ import kotlinx.coroutines.flow.first
3434
import kotlinx.coroutines.flow.take
3535
import kotlinx.coroutines.test.StandardTestDispatcher
3636
import kotlinx.coroutines.test.runTest
37-
import org.junit.runner.RunWith
38-
import org.junit.runners.JUnit4
3937

4038
@OptIn(ExperimentalCoroutinesApi::class)
41-
@RunWith(JUnit4::class)
4239
class LegacyPagingSourceTest {
4340
private val fakePagingState = PagingState(
4441
pages = listOf(

paging/paging-common/src/test/kotlin/androidx/paging/PageEventTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
2929
import kotlinx.coroutines.test.UnconfinedTestDispatcher
3030
import kotlinx.coroutines.test.runTest
3131
import org.junit.runner.RunWith
32-
import org.junit.runners.JUnit4
3332
import org.junit.runners.Parameterized
3433

3534
internal fun <T : Any> adjacentInsertEvent(
@@ -60,7 +59,6 @@ internal fun <T : Any> adjacentInsertEvent(
6059
}
6160

6261
@OptIn(ExperimentalCoroutinesApi::class)
63-
@RunWith(JUnit4::class)
6462
class PageEventTest {
6563
@Test
6664
fun placeholdersException() {

0 commit comments

Comments
 (0)