Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RunWith(RobolectricTestRunner::class)
- @Config(application = TestDaggerTutoApplication::class)
- class MainActivityTest {
- private lateinit var activity: MainActivity
- @Before
- fun setUp(){
- activity = Robolectric.setupActivity(MainActivity::class.java)
- }
- @Test
- @Throws(Exception::class)
- fun shouldShowProperDate() {
- val date = activity.findViewById(R.id.activity_main_date) as TextView
- assertEquals("Sat Oct 19 00:00:00 CET 1991", date.text)
- }
- @Test
- @Throws(Exception::class)
- fun shouldStoreProperEmail() {
- val prefsUtils = activity.prefs
- prefsUtils.saveCurrentEmail("elvis@hotmail.com")
- prefsUtils.saveCurrentEmail("test@hotmail.com")
- assertEquals("test@hotmail.com", prefsUtils.getCurrentEmail())
- }
- }
Add Comment
Please, Sign In to add comment