I'm new to testing.
I've noticed many rules defined in a test tend to be mutable (var) instead of immutable (val).
Here's an example of testing for Android (what I'm currently learning)
@RunWith(AndroidJUnit4::class)
class MyTestSuite {
@get:Rule var activityScenarioRule = activityScenarioRule<MyActivity>()
@Test fun testEvent() {
val scenario = activityScenarioRule.scenario
}
}
Why is this? Is there any case where we need to re-assign the rule to something else? Or is it some requirement for JUnit?