Permalink
Browse files

Readjust due to Issue KentBeck/junit#426 coding style.

  • Loading branch information...
mmichaelis committed Oct 24, 2012
1 parent 6bc83a0 commit be6123772ffa7bc580ea44c2db488852255c401f
@@ -1,42 +1,42 @@
package org.junit.rules;
import java.util.ArrayList;
import java.util.List;
import org.junit.internal.AssumptionViolatedException;
import org.junit.runner.Description;
import org.junit.runners.model.MultipleFailureException;
import org.junit.runners.model.Statement;
import java.util.ArrayList;
import java.util.List;
/**
* TestWatcher is a base class for Rules that take note of the testing
* action, without modifying it. For example, this class will keep a log of each
* passing and failing test:
* <p/>
*
* <pre>
* public static class WatchmanTest {
* private static String watchedLog;
* private static String watchedLog;
*
* &#064;Rule
* public TestWatcher watchman= new TestWatcher() {
* &#064;Override
* protected void failed(Throwable e, Description description) {
* watchedLog+= description + &quot;\n&quot;;
* }
* &#064;Rule
* public TestWatcher watchman= new TestWatcher() {
* &#064;Override
* protected void failed(Throwable e, Description description) {
* watchedLog+= description + &quot;\n&quot;;
* }
*
* &#064;Override
* protected void succeeded(Description description) {
* watchedLog+= description + &quot; &quot; + &quot;success!\n&quot;;
* &#064;Override
* protected void succeeded(Description description) {
* watchedLog+= description + &quot; &quot; + &quot;success!\n&quot;;
* }
* };
*
* &#064;Test
* public void fails() {
* fail();
* }
* &#064;Test
* public void fails() {
* fail();
* }
*
* &#064;Test
* public void succeeds() {
* &#064;Test
* public void succeeds() {
* }
* }
* </pre>
@@ -70,7 +70,7 @@ public void evaluate() throws Throwable {
}
private void succeededQuietly(Description description,
List<Throwable> errors) {
List<Throwable> errors) {
try {
succeeded(description);
} catch (Throwable t) {
@@ -79,7 +79,7 @@ private void succeededQuietly(Description description,
}
private void failedQuietly(Throwable t, Description description,
List<Throwable> errors) {
List<Throwable> errors) {
try {
failed(t, description);
} catch (Throwable t1) {
@@ -88,7 +88,7 @@ private void failedQuietly(Throwable t, Description description,
}
private void skippedQuietly(AssumptionViolatedException e, Description description,
List<Throwable> errors) {
List<Throwable> errors) {
try {
skipped(e, description);
} catch (Throwable t) {
@@ -97,7 +97,7 @@ private void skippedQuietly(AssumptionViolatedException e, Description descripti
}
private void startingQuietly(Description description,
List<Throwable> errors) {
List<Throwable> errors) {
try {
starting(description);
} catch (Throwable t) {
@@ -106,7 +106,7 @@ private void startingQuietly(Description description,
}
private void finishedQuietly(Description description,
List<Throwable> errors) {
List<Throwable> errors) {
try {
finished(description);
} catch (Throwable t) {
@@ -1,13 +1,5 @@
package org.junit.tests.experimental.rules;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.results.PrintableResult;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import static junit.framework.Assert.fail;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -17,6 +9,14 @@
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
import static org.junit.runner.JUnitCore.runClasses;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.results.PrintableResult;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
public class TestWatcherTest {
public static class ViolatedAssumptionTest {
private static StringBuilder watchedLog = new StringBuilder();
@@ -155,4 +155,4 @@ public void testWatcherFailedAndFinishedThrowsException() {
assertThat(result, hasFailureContaining("watcher failed failure"));
assertThat(result, hasFailureContaining("watcher finished failure"));
}
}
}

0 comments on commit be61237

Please sign in to comment.