A Rule is a way to run code before and after the execution of a test in JUnit.
Different kinds of rules
InstantTaskExecutorRuleis a JUnit rule that configuresLiveDatato execute each task synchronouslyMainCoroutineScopeRuleis a custom rule in this codebase that configuresDispatchers.Mainto use aTestCoroutineDispatcherfromkotlinx-coroutines-test. This allows tests to advance a virtual-clock for testing, and allows code to useDispatchers.Mainin unit tests. TheMainCoroutineScopeRulelets you pause, resume, or control the execution of coroutines that are launched on theDispatchers.Main.