Skip to content

Instantly share code, notes, and snippets.

Created November 27, 2018 15:16
What would you like to do?
Just a stupid JUnit rule that prints before and after executing a statement
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
class PrintRule(val label: String) : TestRule {
override fun apply(statement: Statement, description: Description): Statement {
return object : Statement() {
override fun evaluate() {
println("$label before statement")
try {
} finally {
println("$label after statement")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment