Skip to content

Instantly share code, notes, and snippets.

@fbcbl
Created October 9, 2017 09:32
Show Gist options
  • Save fbcbl/56925bac8517c691ea39ed3b3d42e8a0 to your computer and use it in GitHub Desktop.
Save fbcbl/56925bac8517c691ea39ed3b3d42e8a0 to your computer and use it in GitHub Desktop.
package testing.fabiocarballo.com.myapplication
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.whenever
import org.junit.Test
class TemperaturePresenterTest {
val locationProvider: LocationProvider = mock()
val temperatureProvider: TemperatureProvider = mock()
val view: View = mock()
val tested = TemperaturePresenter(locationProvider, temperatureProvider, view)
@Test
fun `correct temperature is displayed in view`() {
whenever(locationProvider.getLocationISOCode()).then { "PT" }
whenever(temperatureProvider.getCelsiusTemperatureAt("PT")).thenReturn(21.0f)
tested.start()
verify(view).displayTemperature(21.0f, "PT")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment