Quantcast
Channel: Examples Java Code Geeks » junit
Viewing all articles
Browse latest Browse all 12

junit rules example

$
0
0
The implementation of a Rule might look like this: import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; public class LoggingRule implements TestRule { public class LoggingStatement extends Statement { private final Statement statement; public LoggingStatement(Statement aStatement, String aName) { statement = aStatement; } @Override public void evaluate() throws Throwable { System.out.println("before: " + name); statement.evaluate(); System.out.println("after: " […]

Viewing all articles
Browse latest Browse all 12

Trending Articles