I have a class with method:
class URAction {
public List<URules> getUrules(Cond cond, Cat cat) {
...
}
}
I want to create its mock:
@Mock
URAction uraMock;
@Test
public void testSth() {
Cond cond1;
Cat cat1;
List<URule> uRules;
// pseudo code
// when uraMock's getUrules is called with cond1 and cat1
// then return uRules
}
The problem is I can make the mock return uRules for only one argument:
when(uraMock.getUrules(argThat(
new ArgumentMatcher<Cond> () {
@Override
public boolean matches(Object argument) {
Cond cond = ((Cond) argument);
if (cond.getConditionKey().equals(cond1.getConditionKey())
return true;
return false;
}
}
))).thenReturn(uRules);
Not sure how to pass the second argument ie Cat in the when call above.
Any help would be greatly appreciated.
Thanks