@Test
public void testGetMethod() {

	try {
		ReflectionEngine engine = new ReflectionEngine();
		TestEngine2 tEngine = new TestEngine2();
		MethodInvoker mInvoker = engine.getMethod(tEngine, "method1", new Object[] { new Object(), new Object() });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { Object.class, Object.class });
		// Test cache:
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] { new Object(), new Object() });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { Object.class, Object.class });
		// Test one only
		mInvoker = engine.getMethod(tEngine, "method2", new Object[] { new Object() });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { Object.class });
		// Test no param
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] {});
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] {});
		// Test no match
		try {
			mInvoker = engine.getMethod(tEngine, "method3", new Object[] { new Object() });
			fail();
		} catch (Exception e) {
		}
		// Test one invalid
		try {
			mInvoker = engine.getMethod(tEngine, "method2", new Object[] { new Object(), new Object() });
			fail();
		} catch (Exception e) {
		}
		// Test many, but invalid
		try {
			mInvoker = engine.getMethod(tEngine, "method1",
					new Object[] { new Object(), new Object(), new Object() });
			fail();
		} catch (Exception e) {
		}
		// Test many
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] { new String(), new ArrayList<String>() });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { String.class, Object.class });
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] { new String(), new String() });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { String.class, char.class });
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] { 2, 2.2 });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { int.class, double.class });
		// Two methods are equal. Selected method will depend on how methods
		// are given
		// during reflection.
		mInvoker = engine.getMethod(tEngine, "method1", new Object[] { "2", true });
		assertArrayEquals(mInvoker.getMethod().getParameterTypes(), new Class[] { Object.class, Boolean.class });
	} catch (Exception e) {
		e.printStackTrace();
		fail();
	}
}