# JUnit
# Rules
To add a JUnit rule (opens new window) to a test fixture:
@Rule @JvmField val myRule = TemporaryFolder()
The @JvmField
annotation is necessary to expose the backing field with the same visibility (public) as the myRule
property (see answer (opens new window)). JUnit rules require the annotated rule field to be public.