ExampleInstrumentedTest.kt 944 B

12345678910111213141516171819202122232425262728293031323334
  1. package io.legato.kazusa
  2. import android.content.Context
  3. import android.net.Uri
  4. import android.util.Log
  5. import androidx.test.core.app.ApplicationProvider
  6. import androidx.test.ext.junit.runners.AndroidJUnit4
  7. import org.junit.Test
  8. import org.junit.runner.RunWith
  9. /**
  10. * Instrumented test, which will execute on an Android device.
  11. *
  12. * See [testing documentation](http://d.android.com/tools/testing).
  13. */
  14. @RunWith(AndroidJUnit4::class)
  15. class ExampleInstrumentedTest {
  16. @Test
  17. fun testContentProvider() {
  18. // Context of the app under test.
  19. val appContext = ApplicationProvider.getApplicationContext<Context>()
  20. Log.d(
  21. "test",
  22. appContext.contentResolver.query(
  23. Uri.parse("content://io.legado.app.api.ReaderProvider/sources/query"),
  24. null,
  25. null,
  26. null,
  27. null
  28. )
  29. !!.getString(0)
  30. )
  31. }
  32. }