Mockito/PowerMockito - Mock a method that receives Lambda expression as a parameter

Viewed 6951

I want to mock the following method. But I don't find any Mockito.Matchers for the second parameter which uses Java.util.Function.

public List<String> convertStringtoInt(List<Integer> intList,Function<Integer, String> intToStringExpression) {
        return intList.stream()
                .map(intToStringExpression)
                .collect(Collectors.toList());
    }

I am looking for something like this:

Mockito.when(convertStringtoInt(Matchers.anyList(),Matchers.anyFunction()).thenReturn(myMockedList)
1 Answers
Related