package org.junit.tests.experimental;

import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;

import java.util.Arrays;

import org.hamcrest.Matcher;
import org.junit.experimental.results.PrintableResult;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.notification.Failure;

@RunWith(Theories.class)
public class MatcherTest {
	@DataPoint
	public static Matcher<?> SINGLE_FAILURE= hasSingleFailureContaining("cheese");

	@DataPoint
	public static Matcher<?> ANY_FAILURE= hasFailureContaining("cheese");

	// TODO: (Dec 7, 2007 1:25:37 PM) DUP

	@DataPoint
	public static PrintableResult TWO_FAILURES_ONE_CHEESE= new PrintableResult(
			Arrays.asList(new Failure(Description.EMPTY, new Error("cheese")),
					new Failure(Description.EMPTY, new Error("mustard"))));

	@Theory
	public <T> void differentMatchersHaveDifferentDescriptions(
			Matcher<T> matcher1, Matcher<T> matcher2, T value) {
		assumeThat(value, matcher1);
		assumeThat(value, not(matcher2));
		assertThat(matcher1.toString(), not(matcher2.toString()));
	}

}

@@ -940,48 +940,8 @@
 );%0A%0A
-%09// TODO: (Dec 7, 2007 1:25:37 PM) DUP%0A%0A
 %09@Da
@@ -940,32 +940,32 @@
 );%0A%0A%09@DataPoint%0A
+
 %09public static P
@@ -1046,106 +1046,34 @@
 ist(
-new F
+f
 ailure(
-Description.EMPTY, new Error(%22cheese%22)),%0A%09%09%09%09%09new Failure(Description.EMPTY, new Error
+%22cheese%22), failure
 (%22mu
@@ -1081,17 +1081,16 @@
 tard%22)))
-)
 ;%0A%0A%09@The
@@ -1342,10 +1342,122 @@
 ));%0A%09%7D%0A%0A
+%09private static Failure failure(String string) %7B%0A%09%09return new Failure(Description.EMPTY, new Error(string));%0A%09%7D%0A
 %7D%0A

Remove duplication in test logic