@Test
public void shouldValidateTypeThrowExceptionOnInvalidType() throws Exception {

  // given
  final List<Object> parameters = Arrays.<Object>asList("string", 1, new LinkedList<>());
  final RequestMethod<?> requestMethod = spy(RequestMethod.class);
  try {
    // when
    requestMethod.validateType(parameters, 4, String.class);
    fail("Should throw IllegalArgumentException on illegal index");
  } catch (IllegalArgumentException e) {
    // then
  }
  try {
    // when
    requestMethod.validateType(parameters, 0, Integer.class);
    fail("Should throw IllegalArgumentException on illegal type");
  } catch (IllegalArgumentException e) {
    // then
  }
}