DataRepositoryTest.kt 961 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.sduduzog.slimlauncher
  2. import android.app.Application
  3. import androidx.test.filters.LargeTest
  4. import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
  5. import androidx.test.platform.app.InstrumentationRegistry
  6. import com.sduduzog.slimlauncher.data.DataRepository
  7. import org.junit.After
  8. import org.junit.Before
  9. import org.junit.Test
  10. import org.junit.runner.RunWith
  11. @LargeTest
  12. @RunWith(AndroidJUnit4ClassRunner::class)
  13. class DataRepositoryTest {
  14. private var repository: DataRepository? = null
  15. @Before
  16. fun createRepository(){
  17. val context = InstrumentationRegistry.getInstrumentation().targetContext.applicationContext
  18. repository = DataRepository.getInstance(context as Application)
  19. }
  20. @After
  21. fun closeRepository(){
  22. repository = null
  23. }
  24. @Test
  25. fun assertList(){
  26. val list = listOf(1, 2, 3, 4, 5)
  27. val newList = list.distinctBy {
  28. it == 2
  29. }
  30. }
  31. }