@Test
void failsImmediately() {

    final LoanApi mock = mock(LoanApi.class);
    final Api<LoanApi> api = new Api<>(mock, counter);
    final Function<LoanApi, String> function = (a) -> {
        throw new IllegalStateException();
    };
    assertThatThrownBy(() -> api.call(function)).isInstanceOf(IllegalStateException.class);
    assertThat(counter.count()).isEqualTo(1);
}