package org.junit.tests.experimental.theories;

import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;

import org.hamcrest.Matcher;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.ParameterSignature;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.experimental.theories.suppliers.TestedOn;
import org.junit.runner.RunWith;

@RunWith(Theories.class)
public class ParameterSignatureTest {
	@DataPoint
	public static Method getType() throws SecurityException,
			NoSuchMethodException {
		return ParameterSignatureTest.class.getMethod("getType", Method.class,
				int.class);
	}

	@DataPoint
	public static int ZERO= 0;

	@DataPoint
	public static int ONE= 1;

	@Theory
	public void getType(Method method, int index) {
		assumeTrue(index < method.getParameterTypes().length);
		assertEquals(method.getParameterTypes()[index], ParameterSignature
				.signatures(method).get(index).getType());
	}

	public void foo(@TestedOn(ints= { 1, 2, 3 })
	int x) {
	}

	@Test
	public void getAnnotations() throws SecurityException,
			NoSuchMethodException {
		Method method= ParameterSignatureTest.class.getMethod("foo", int.class);
		List<Annotation> annotations= ParameterSignature.signatures(method)
				.get(0).getAnnotations();
		assertThat(annotations,
				hasItem(annotationOfClass(TestedOn.class)));
	}

	private Matcher<Annotation> annotationOfClass(Class<?> clazz) {
		return instanceOf(clazz);
	}
}

@@ -131,25 +131,18 @@
 tchers.i
-nstanceOf
+sA
 ;%0Aimport
@@ -368,37 +368,8 @@
 t;%0A%0A
-import org.hamcrest.Matcher;%0A
 impo
@@ -1621,139 +1621,28 @@
 tem(
-annotationOfClass(TestedOn.class)));%0A%09%7D%0A%0A%09private Matcher%3CAnnotation%3E annotationOfClass(Class%3C?%3E clazz) %7B%0A%09%09return instanceOf(clazz
+isA(TestedOn.class))
 );%0A%09

Simplify matcher expression in ParameterSignatureTest