comparison test/org/tmatesoft/hg/test/ErrorCollectorExt.java @ 269:7af843ecc378

Respect glob pattern with alternatives {a,b}
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 23 Aug 2011 23:47:38 +0200
parents 0b2dcca7de9f
children 6865eb742883
comparison
equal deleted inserted replaced
268:c5980f287cc4 269:7af843ecc378
19 import static org.junit.Assert.assertThat; 19 import static org.junit.Assert.assertThat;
20 20
21 import java.util.concurrent.Callable; 21 import java.util.concurrent.Callable;
22 22
23 import org.hamcrest.Matcher; 23 import org.hamcrest.Matcher;
24 import org.junit.internal.runners.model.MultipleFailureException;
24 import org.junit.rules.ErrorCollector; 25 import org.junit.rules.ErrorCollector;
25 26
26 /** 27 /**
27 * Expose verify method for allow not-junit runs to check test outcome 28 * Expose verify method for allow not-junit runs to check test outcome
28 * 29 *
29 * @author Artem Tikhomirov 30 * @author Artem Tikhomirov
30 * @author TMate Software Ltd. 31 * @author TMate Software Ltd.
31 */ 32 */
32 final class ErrorCollectorExt extends ErrorCollector { 33 final class ErrorCollectorExt extends ErrorCollector {
33 public void verify() throws Throwable { 34 public void verify() throws Throwable {
34 super.verify(); 35 try {
36 super.verify();
37 } catch (MultipleFailureException ex) {
38 for (Throwable t : ex.getFailures()) {
39 t.printStackTrace();
40 }
41 throw ex;
42 }
35 } 43 }
36 44
37 public <T> void checkThat(final String reason, final T value, final Matcher<T> matcher) { 45 public <T> void checkThat(final String reason, final T value, final Matcher<T> matcher) {
38 checkSucceeds(new Callable<Object>() { 46 checkSucceeds(new Callable<Object>() {
39 public Object call() throws Exception { 47 public Object call() throws Exception {
40 assertThat(reason, value, matcher); 48 assertThat(reason, value, matcher);
41 return value; 49 return value;
42 } 50 }
43 }); 51 });
44 } 52 }
53
54 public void assertTrue(final String reason, final boolean value) {
55 checkSucceeds(new Callable<Object>() {
56 public Object call() throws Exception {
57 org.junit.Assert.assertTrue(reason, value);
58 return null;
59 }
60 });
61 }
45 } 62 }