|
|
|
@ -10,6 +10,7 @@ import io.mockk.mockk
|
|
|
|
|
import io.mockk.mockkStatic
|
|
|
|
|
import io.mockk.verify
|
|
|
|
|
import android.util.Log
|
|
|
|
|
import org.mozilla.fenix.BuildConfig
|
|
|
|
|
|
|
|
|
|
@ObsoleteCoroutinesApi
|
|
|
|
|
@RunWith(RobolectricTestRunner::class)
|
|
|
|
@ -17,18 +18,20 @@ import android.util.Log
|
|
|
|
|
|
|
|
|
|
class LogTest {
|
|
|
|
|
|
|
|
|
|
val numCalls = if (BuildConfig.DEBUG) 1 else 0
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun `Test log debug function`() {
|
|
|
|
|
mockkStatic(Log::class)
|
|
|
|
|
logDebug("hi", "hi")
|
|
|
|
|
verify { (Log.d("hi", "hi")) }
|
|
|
|
|
verify(exactly = numCalls) { (Log.d("hi", "hi")) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun `Test log warn function with tag and message args`() {
|
|
|
|
|
mockkStatic(Log::class)
|
|
|
|
|
logWarn("hi", "hi")
|
|
|
|
|
verify { (Log.w("hi", "hi")) }
|
|
|
|
|
verify(exactly = numCalls) { (Log.w("hi", "hi")) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -36,7 +39,7 @@ class LogTest {
|
|
|
|
|
mockkStatic(Log::class)
|
|
|
|
|
val mockThrowable: Throwable = mockk(relaxed = true)
|
|
|
|
|
logWarn("hi", "hi", mockThrowable)
|
|
|
|
|
verify { (Log.w("hi", "hi", mockThrowable)) }
|
|
|
|
|
verify(exactly = numCalls) { (Log.w("hi", "hi", mockThrowable)) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -44,6 +47,6 @@ class LogTest {
|
|
|
|
|
mockkStatic(Log::class)
|
|
|
|
|
val mockThrowable: Throwable = mockk(relaxed = true)
|
|
|
|
|
logErr("hi", "hi", mockThrowable)
|
|
|
|
|
verify { (Log.e("hi", "hi", mockThrowable)) }
|
|
|
|
|
verify(exactly = numCalls) { (Log.e("hi", "hi", mockThrowable)) }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|