Created
July 5, 2017 04:41
-
-
Save bastman/2fb949c1ad96e49ed963b7e9e8df96ec to your computer and use it in GitHub Desktop.
migrate a codebase from java to kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check the examples ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment