diff test/org/tmatesoft/hg/test/ErrorCollectorExt.java @ 103:0b2dcca7de9f

ErrorCollector in tests to grab multiple errors
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 28 Jan 2011 04:57:46 +0100
parents a3a2e5deb320
children 7af843ecc378
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/ErrorCollectorExt.java	Fri Jan 28 03:50:52 2011 +0100
+++ b/test/org/tmatesoft/hg/test/ErrorCollectorExt.java	Fri Jan 28 04:57:46 2011 +0100
@@ -16,6 +16,11 @@
  */
 package org.tmatesoft.hg.test;
 
+import static org.junit.Assert.assertThat;
+
+import java.util.concurrent.Callable;
+
+import org.hamcrest.Matcher;
 import org.junit.rules.ErrorCollector;
 
 /**
@@ -28,4 +33,13 @@
 	public void verify() throws Throwable {
 		super.verify();
 	}
+
+	public <T> void checkThat(final String reason, final T value, final Matcher<T> matcher) {
+		checkSucceeds(new Callable<Object>() {
+			public Object call() throws Exception {
+				assertThat(reason, value, matcher);
+				return value;
+			}
+		});
+	}
 }
\ No newline at end of file