@Test(expected = CRestException.class)
public void shouldThrowExceptionWhenParamProcessingFail() throws Exception {

    Param mockParam = mock(Param.class);
    Exception exception = new Exception();
    ParamProcessor paramProcessor = mock(ParamProcessor.class);
    when(paramProcessor.process(mockParam, UTF8, true)).thenThrow(exception);
    ParamConfig paramConfig = mock(ParamConfig.class);
    when(paramConfig.getParamProcessor()).thenReturn(paramProcessor);
    when(mockParam.getParamConfig()).thenReturn(paramConfig);
    try {
        ParamProcessors.iterate(asList(mockParam), UTF8).hasNext();
    } catch (Exception e) {
        assertSame(exception, e.getCause());
        throw e;
    }
}