Application to instantiate Plugin

Summary:
Plugin needs both the Context and Application. Application is Context. Pass Application.

:)

Reviewed By: LukeDefeo

Differential Revision: D38831033

fbshipit-source-id: ff12a8ddc875fb54389e591a1c1c9febedb3aa37
This commit is contained in:
Lorenzo Blasa
2022-08-19 08:47:58 -07:00
committed by Facebook GitHub Bot
parent fbbb793497
commit b5bdd56d2c
6 changed files with 23 additions and 7 deletions

View File

@@ -7,17 +7,30 @@
package com.facebook.flipper.plugins.uidebugger
import com.facebook.flipper.plugins.uidebugger.core.ApplicationRef
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class)
class UIDebuggerFlipperPluginTest {
val app = Mockito.spy(RuntimeEnvironment.application)
private var appRef: ApplicationRef = Mockito.spy(ApplicationRef(app))
@Before
open fun setup() {
Mockito.`when`(app.applicationContext).thenReturn(app)
Mockito.`when`(app.packageName).thenReturn("com.facebook.flipper")
}
@Throws(Exception::class)
@Test
fun emptyTest() {
var plugin = UIDebuggerFlipperPlugin()
var plugin = UIDebuggerFlipperPlugin(app)
Assert.assertNotNull(plugin)
}
}