@Test
public void invokeMethod() {

    assertNull(ReflectionUtil.invokeMethod(null, null));
    assertNull(ReflectionUtil.invokeMethod(null, new Object(), new Object()));
    assertNull(ReflectionUtil.invokeMethod(null, new Object()));
    assertNull(ReflectionUtil.invokeMethod((Object) null, (String) null, null));
    assertNull(ReflectionUtil.invokeMethod((Object) null, (String) null, (Object[]) null, (Class<?>) null));
    assertNull(ReflectionUtil.invokeMethod("", (String) null, (Object[]) null, (Class<?>) null));
    assertNull(ReflectionUtil.invokeMethod((Object) null, (String) null, new Object[] {}, (Class<?>) null));
    assertNull(ReflectionUtil.invokeMethod((Object) null, (String) null, (Object[]) null, Emptys.EMPTY_CLASS_ARRAY));
    assertNull(ReflectionUtil.invokeMethod(null, new Object(), new Object()));
    assertNull(ReflectionUtil.invokeMethod(null, new Object()));
    Method method = null;
    try {
        method = String.class.getMethod("valueOf", int.class);
        assertEquals("1", ReflectionUtil.invokeMethod(method, null, 1));
        assertEquals("1", ReflectionUtil.invokeMethod(method, "", 1));
        assertEquals("1", ReflectionUtil.invokeMethod(method, new Object(), 1));
        method = String.class.getMethod("trim");
        assertEquals("xxx", ReflectionUtil.invokeMethod(method, " xxx "));
        assertEquals("xxx", ReflectionUtil.invokeMethod(method, new Object()));
    } catch (Exception e) {
        assertTrue(e instanceof RuntimeException);
    }
    List<String> list = CollectionUtil.createArrayList();
    try {
        method = ArrayList.class.getDeclaredMethod("RangeCheck", int.class);
        ReflectionUtil.invokeMethod(method, list, Integer.MAX_VALUE);
    } catch (Exception e) {
        InvocationTargetException ex = (InvocationTargetException) e.getCause();
        if (ex != null) {
            assertTrue(ex.getTargetException() instanceof IndexOutOfBoundsException);
        }
    }
    try {
        assertEquals("xxx", ReflectionUtil.invokeMethod(" xxx ", "trim", null));
        assertEquals("xxx", ReflectionUtil.invokeMethod(new Object(), "trim", null));
    } catch (Exception e) {
        assertTrue(e instanceof RuntimeException);
    }
    list = CollectionUtil.createArrayList();
    try {
        ReflectionUtil.invokeMethod(list, "RangeCheck", new Object[] { Integer.MAX_VALUE }, int.class);
    } catch (Exception e) {
        if (e.getCause() instanceof NoSuchMethodException) {
        } else {
            InvocationTargetException ex = (InvocationTargetException) e.getCause();
            assertTrue(ex.getTargetException() instanceof IndexOutOfBoundsException);
        }
    }
}