Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Beispiel für Kombination mehrerer Rules in einem Test

  • Loading branch information...
commit 89c284cf0e6c42de25c3744e9e81101d4c214a1f 1 parent 54e82f3
Marc Philipp authored
7 junit-rules/src/main/java/org/junit/rules/watcher/BeepOnFailure.java
View
@@ -7,7 +7,8 @@
public class BeepOnFailure extends TestWatcher {
- @Override protected void failed(Throwable e, Description description) {
- Toolkit.getDefaultToolkit().beep();
- }
+ @Override
+ protected void failed(Throwable e, Description description) {
+ Toolkit.getDefaultToolkit().beep();
+ }
}
26 junit-rules/src/test/java/org/junit/rules/multiple/CombiningMultipleRules.java
View
@@ -0,0 +1,26 @@
+package org.junit.rules.multiple;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
+import org.junit.rules.watcher.BeepOnFailure;
+
+public class CombiningMultipleRules {
+
+ @Rule
+ public TestRule beep = new BeepOnFailure();
+
+ @Rule
+ public ExpectedException exceptions = ExpectedException.none();
+
+ @Rule
+ public TestName test = new TestName();
+
+ @Test
+ public void test() {
+ exceptions.expect(IllegalArgumentException.class);
+ throw new RuntimeException("Hello from " + test.getMethodName());
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.