Last active
March 13, 2022 05:17
-
-
Save Farhandroid/967bf7fad81caa71e4ce650d70a0b809 to your computer and use it in GitHub Desktop.
TestSuspendFunction
This file contains hidden or 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
class Car { | |
var isEngineTurnedOn = false | |
suspend fun turnOnEngine(){ | |
delay(4000) | |
isEngineTurnedOn = true | |
} | |
} | |
class CarTest { | |
private val car = Car() | |
@Test | |
fun turnOnEngine() = runTest{ | |
car.turnOnEngine() | |
Assert.assertTrue(car.isEngineTurnedOn) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment