I am testing a java method which uses lambda expression to match a value.
I want to test the condition for both true and false.
employee.getAppraisals().stream().anyMatch(appraisal::isPromoted)
And i tried to use the code below to create the mockito unit test but it never works. The link i followed is : Use Mockito 2.0.7 to mock lambda expressions
Mockito.when(employee.getAppraisals()
.stream()
..anyMatch(p->p.equals(Mockito.any()))).thenReturn(true)
But i dont know how to mock Promotion object to return its bean proeprty value of promotion.isPromoted as true using mockito.