Skip to content

Instantly share code, notes, and snippets.

@bastman
Created July 5, 2017 04:41
Show Gist options
  • Save bastman/2fb949c1ad96e49ed963b7e9e8df96ec to your computer and use it in GitHub Desktop.
Save bastman/2fb949c1ad96e49ed963b7e9e8df96ec to your computer and use it in GitHub Desktop.
migrate a codebase from java to kotlin
@ActiveProfiles("test")
abstract class AbstractTest {
@Rule
val springMethodRule = SpringMethodRule()
companion object {
@ClassRule
val SPRING_CLASS_RULE = SpringClassRule()
}
}
org.junit.internal.runners.rules.ValidationError: The @Rule 'springMethodRule' must be public.
How to fix?
- add @JvmField (once your codebase has fully moved to kotlin, remove that annotation)
@ActiveProfiles("test")
abstract class AbstractIntegrationTestBase {
@Rule @JvmField
val springMethodRule = SpringMethodRule()
companion object {
@ClassRule @JvmField
val SPRING_CLASS_RULE = SpringClassRule()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment