Just a stupid JUnit rule that prints before and after executing a statement
This file contains 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
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 { | |
statement.evaluate() | |
} finally { | |
println("$label after statement") | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment