Skip to content

Instantly share code, notes, and snippets.

@dmcg
Created November 12, 2018 09:36
Show Gist options
  • Select an option

  • Save dmcg/f59eb3439b3552f7e37550957ab776c2 to your computer and use it in GitHub Desktop.

Select an option

Save dmcg/f59eb3439b3552f7e37550957ab776c2 to your computer and use it in GitHub Desktop.
Kotlin JMock JUnit TestRule
/**
* A [TestRule] as opposed to [MethodRule], without the auto-population gubbins.
*/
class JUnitTestRuleMockery : JUnit4Mockery(), TestRule {
override fun apply(base: Statement, description: Description) = object : Statement() {
override fun evaluate() {
base.evaluate()
assertIsSatisfied()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment