# JUnit

# Rules

To add a JUnit rule 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). JUnit rules require the annotated rule field to be public.