Closed GoogleCodeExporter closed 9 years ago
You're right - we'll fix it
Original comment by szcze...@gmail.com
on 17 Apr 2009 at 2:52
Fixed in trunk.
any(T.class) is now an alias to anyObject()
Original comment by szcze...@gmail.com
on 19 Apr 2009 at 5:31
Is there a work around for this? How do we match on a null while not returning
an Object?
Original comment by antony.s...@gmail.com
on 20 May 2009 at 11:52
You match for null just using null keyword. You match not-nulls using notNull()
matcher (or something similar, don't remember now).
Original comment by szcze...@gmail.com
on 20 May 2009 at 12:17
Thanks For the response.
I can't do that in my situation as it's a two parameter function call, the
first I want to use anyInt and the
second I want to use null. But you can't mix matched with value. Null being the
value.
Original comment by antony.s...@gmail.com
on 20 May 2009 at 12:23
To demonstrate, I think this works:
when( mockProfileManager.getProfileByPersonIdAndNetwork( anyInt(), argThat( new
ArgumentMatcher<Network>(){
@Override
public boolean matches(Object argument) {
return true;
}
} ) ) ).thenReturn( profile );
Original comment by antony.s...@gmail.com
on 20 May 2009 at 12:27
Try isNull() matcher or simply eq(null) :)
Original comment by szcze...@gmail.com
on 20 May 2009 at 1:30
Yeah I thought so - I tried that as well before I posted here.
isNull gives The method getProfileByPersonIdAndNetwork(int, Network) in the
type ProfileManagerImpl is not
applicable for the arguments (int, Object) NavigationPanelTest.java invite-
commons/src/test/java/com/componence/invite/panelTests line 112 Java Problem
eq(null) also gives the same error.
Original comment by antony.s...@gmail.com
on 20 May 2009 at 8:05
Original comment by szcze...@gmail.com
on 9 Jun 2009 at 3:15
Original issue reported on code.google.com by
mhack...@kanayo.com
on 17 Apr 2009 at 2:47Attachments: