Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.takeWhile
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

/**
* reproduces b/203594733
*/
@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
public class CachedPageEventFlowLeakTest {
private val gcHelper = GarbageCollectionTestHelper()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.yield
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class CachingTest {
private val tracker = ActiveFlowTrackerImpl()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import androidx.kruth.assertThat
import kotlin.test.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class DataSourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ import androidx.paging.LoadType.REFRESH
import androidx.paging.PageEvent.Drop
import androidx.paging.PageEvent.StaticList
import kotlin.test.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class FlattenedPageEventStorageTest {
private val list = FlattenedPageEventStorage<String>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.single
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

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

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class HeaderFooterTest {

private fun <T : Any> PageEvent<T>.toPagingData() = PagingData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
@OptIn(ExperimentalCoroutinesApi::class)
class HintHandlerTest {
private val hintHandler = HintHandler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import kotlin.test.fail
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.ArgumentCaptor
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
Expand All @@ -36,7 +34,6 @@ import org.mockito.kotlin.mock

@OptIn(ExperimentalCoroutinesApi::class)
@Suppress("DEPRECATION")
@RunWith(JUnit4::class)
class ItemKeyedDataSourceTest {

// ----- STANDARD -----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class LegacyPageFetcherTest {
private val testDispatcher = StandardTestDispatcher()
private val data = List(9) { "$it" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class LegacyPagingSourceTest {
private val fakePagingState = PagingState(
pages = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.runners.Parameterized

internal fun <T : Any> adjacentInsertEvent(
Expand Down Expand Up @@ -60,7 +59,6 @@ internal fun <T : Any> adjacentInsertEvent(
}

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class PageEventTest {
@Test
fun placeholdersException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ import kotlin.test.assertEquals
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class PageFetcherSnapshotStateTest {
val testScope = TestScope()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,8 @@ import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import kotlinx.coroutines.yield
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class, ExperimentalPagingApi::class)
@RunWith(JUnit4::class)
class PageFetcherSnapshotTest {
private val testScope = TestScope(UnconfinedTestDispatcher())
private val retryBus = ConflatedEventBus<Unit>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class, ExperimentalPagingApi::class)
@RunWith(JUnit4::class)
class PageFetcherTest {
private val testScope = TestScope(UnconfinedTestDispatcher())
private val pagingSourceFactory = suspend { TestPagingSource() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class PageKeyedDataSourceTest {
internal data class Item(val name: String)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.fail
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@Suppress("TestFunctionName")
internal fun <T : Any> PagePresenter(
Expand Down Expand Up @@ -82,7 +80,6 @@ internal fun <T : Any> PagePresenter<T>.dropPages(
internal fun <T : Any> PagePresenter<T>.asList() = List(size) { get(it) }

@Suppress("SameParameterValue")
@RunWith(JUnit4::class)
class PagePresenterTest {
private fun verifyAppend(
initialItems: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class PagedListConfigBuilderTest {
@Test
fun defaults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class PagedListConfigTest {
@Test
fun defaults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class PagedListTest {
companion object {
private val ITEMS = List(100) { "$it" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions

@RunWith(JUnit4::class)
class PagedStorageTest {
private fun pageOf(vararg strings: String): Page<Any, String> = Page(
data = strings.asList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import androidx.paging.PagingConfig.Companion.MAX_SIZE_UNBOUNDED
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class PagingConfigTest {
@Test
fun defaults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class PagingSourceTest {

// ----- STANDARD -----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class PagingStateTest {
@Test
fun closestItemToPosition_withoutPlaceholders() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions

@Suppress("DEPRECATION")
@RunWith(JUnit4::class)
class PositionalDataSourceTest {
private fun computeInitialLoadPos(
requestedStartPosition: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class, ExperimentalPagingApi::class)
@RunWith(JUnit4::class)
class RemoteMediatorAccessorTest {
private val testScope = TestScope(UnconfinedTestDispatcher())
private var mockStateId = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

private fun <T : Any> List<PageEvent<T>>.getItems() = mapNotNull { event ->
when (event) {
Expand All @@ -55,7 +53,6 @@ private fun <T : Any> assertInsertData(
}

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class SeparatorsTest {
@Test
fun refreshFull() = runTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class SeparatorsWithRemoteMediatorTest {
@Test
fun prependAfterPrependComplete() = runTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeout
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(JUnit4::class)
class SingleRunnerTest {
private val testScope = TestScope()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import kotlin.test.Test
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class WrappedItemKeyedDataSourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import kotlin.test.Test
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class WrappedPageKeyedDataSourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package androidx.paging

import kotlin.test.Test
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class WrappedPositionalDataSourceTest {

@Test
Expand Down