isAssignableFrom returns false

21 views
Skip to first unread message

CraigA

unread,
Feb 13, 2012, 11:30:56 AM2/13/12
to PowerMock
A mocked object apparently can't be tested against via
isAssignableFrom(). For example:

Foo foo = createMock(Foo.class);
if (Foo.getClass().isAssignableFrom(Foo.class)

always returns false. Is there a way to make this work? If not, is
there some way to work around this?

Thanks.

CraigA

unread,
Feb 13, 2012, 4:32:51 PM2/13/12
to PowerMock
Sorry, that should say:

if (foo.getClass.isAssignableFrom(Foo.class))

so that it's using the mocked object. So - "foo.getClass()" rather
than "Foo.getClass()". Of course.
Reply all
Reply to author
Forward
0 new messages