I want to assert that activity is successfully created with given condition. However, there is nothing like
controller.get().isCreated
My code is:
@get:Rule
val exception: ExpectedException = ExpectedException.none()
@Test
fun test_example() {
// Given
val intent = getMyIntent()
// When
val controller = Robolectric.buildActivity(
MyActivity::class.java,
intent
).setup()
// Then
// no exception is expected and
assertTrue(controller != null)
}
Yes, if there is any exception, this test would fail. However, I want to explicitly assert that my activity is successfully created.