Last active
September 3, 2018 14:01
-
-
Save kozmi55/ae2a0a13c1f5f5d1b2b8042d2a630229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4::class) | |
class UserListFragmentTest { | |
@Rule | |
@JvmField | |
var activityRule = ActivityTestRule(MainActivity::class.java, true, false) | |
@Mock | |
private lateinit var mockUserRepository: UserRepository | |
private fun withRecyclerView(recyclerViewId: Int): RecyclerViewMatcher { | |
return RecyclerViewMatcher(recyclerViewId) | |
} | |
@Before | |
fun setUp() { | |
MockitoAnnotations.initMocks(this) | |
val instrumentation = InstrumentationRegistry.getInstrumentation() | |
val app = instrumentation.targetContext.applicationContext as TestApplication | |
DaggerTestApplicationComponent | |
.builder() | |
.appModule(TestApplicationModule(mockUserRepository)) | |
.create(app) | |
.inject(app) | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment