@Test
public void testMemoizeLastError() {

    Function<String, String> evaluator = Evaluators.memoizeLast(s -> {
        counter++;
        if (s.equals("error")) {
            throw SIMULATED_ERROR;
        }
        return s.toUpperCase();
    });
    applyWithErrorResult(evaluator);
    applyWithErrorResult(evaluator);
    assertThat(counter).isEqualTo(1);
    assertThat(evaluator.apply("a")).isEqualTo("A");
    assertThat(counter).isEqualTo(2);
}