package org.hamcrest.junit;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.junit.MatcherAssert.assertThat;
import static org.hamcrest.junit.MatcherAssume.assumeThat;

import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.AssumptionViolatedException;
import org.junit.runner.RunWith;

@RunWith(Theories.class)
public class AssumptionViolatedExceptionTest {
    @DataPoint
    public static Object TWO = 2;

    @DataPoint
    public static Matcher<?> IS_THREE = is(3);

    @DataPoint
    public static Matcher<?> NULL = null;

    @Theory
    public void toStringReportsMatcher(Object actual, Matcher<Object> matcher) {
        assumeThat(matcher, notNullValue());
        assertThat(new AssumptionViolatedException(actual, matcher).toString(),
                containsString(matcher.toString()));
    }

    @Theory
    public void toStringReportsValue(Object actual, Matcher<Object> matcher) {
        assertThat(new AssumptionViolatedException(actual, matcher).toString(),
                containsString(String.valueOf(actual)));
    }

    @Test
    public void AssumptionViolatedExceptionDescribesItself() {
        AssumptionViolatedException e = new AssumptionViolatedException(3, is(2));
        assertThat(StringDescription.asString(e), is("got: <3>, expected: is <2>"));
    }

    @Test
    public void simpleAssumptionViolatedExceptionDescribesItself() {
        AssumptionViolatedException e = new AssumptionViolatedException("not enough money");
        assertThat(StringDescription.asString(e), is("not enough money"));
    }
}

@@ -359,24 +359,70 @@
 escription;%0A
+import org.junit.AssumptionViolatedException;%0A
 import org.j
@@ -582,54 +582,8 @@
 ry;%0A
-import org.junit.AssumptionViolatedException;%0A
 impo
@@ -717,22 +717,23 @@
  static 
-Object
+Integer
  TWO = 2
@@ -776,17 +776,23 @@
 Matcher%3C
-?
+Integer
 %3E IS_THR
@@ -849,9 +849,15 @@
 her%3C
-?
+Integer
 %3E NU
@@ -919,22 +919,23 @@
 Matcher(
-Object
+Integer
  actual,
@@ -935,38 +935,39 @@
 actual, Matcher%3C
-Object
+Integer
 %3E matcher) %7B%0A   
@@ -1197,22 +1197,23 @@
 tsValue(
-Object
+Integer
  actual,
@@ -1225,14 +1225,15 @@
 her%3C
-Object
+Integer
 %3E ma
@@ -1411,17 +1411,17 @@
 ic void 
-A
+a
 ssumptio
@@ -1430,32 +1430,43 @@
 iolatedException
+WithMatcher
 DescribesItself(

Bring across test changes to AssumptionViolatedExceptionTest from JUnit 4.12.