class WinterTestSession
WinterTestSession helps to write cleaner tests that require Winter
by eliminating
boilerplate code.
This is used by the Winter JUnit4 and JUnit5 modules but can also be used directly with other test frameworks.
Example:
class ExampleTest {
private lateinit val session: WinterTestSession
@Mock service: Service = mock()
@Before fun setup() {
session = WinterTestSession.session(this) {
application = MyWinterApp
bindAllMocks()
testGraph("activity")
}
session.start()
}
@After fun teardown() {
session.stop()
}
}
See Also
class Builder |
val allGraphs: List<Graph>
A list of all graphs that where opened after calling start. |
|
val requireTestGraph: Graph
The test graph. |
|
var testGraph: Graph?
The test graph if open otherwise null. |
fun resolve(type: Class<*>, qualifier: Any? = null): Any
|
|
fun start(): Unit
Call this to start the session. |
|
fun stop(): Unit
Call this to stop the session. |
fun session(vararg testInstances: Any, block: WinterTestSessionBlock): WinterTestSession |