Last active
November 12, 2017 21:18
-
-
Save augustoerico/e88d3e5b59ae5d023d83c114b8ffa708 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
package com.cgbros.silkhub.activity.listener | |
import android.widget.TextView | |
import com.cgbros.silkhub.R | |
import com.cgbros.silkhub.activity.LoginActivity | |
import com.google.firebase.database.FirebaseDatabase | |
import org.junit.After | |
import org.junit.Assert.assertEquals | |
import org.junit.Before | |
import org.junit.Test | |
import org.robolectric.Robolectric | |
import org.mockito.Mockito.`when` as whenCalled | |
class LoginActivityUnitTest { | |
@Before | |
fun setup() { | |
println("Setting up test environment...") | |
} | |
@After | |
@Before | |
fun cleanUp() { | |
println("Cleaning up....") | |
FirebaseDatabase.getInstance().reference.removeValue() | |
println("Done!") | |
} | |
@Test | |
fun shouldDisplayNumberOfOpenSessions() { | |
// Given | |
val activity = Robolectric.buildActivity(LoginActivity::class.java) | |
.create() | |
.start() | |
.visible() | |
.get() | |
// When | |
val openSessions = activity.findViewById<TextView>(R.id.login_open_sessions).text | |
// Then | |
assertEquals(openSessions, "1 open sessions") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment