Issue 251 in mockito: ClassCastException when mocking a method with a return type of List<SomeInterface>

790 views
Skip to first unread message

moc...@googlecode.com

unread,
Mar 22, 2011, 4:51:31 PM3/22/11
to mocki...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 251 by gipszlya...@gmail.com: ClassCastException when mocking a
method with a return type of List<SomeInterface>
http://code.google.com/p/mockito/issues/detail?id=251

What steps will reproduce the problem?
1. see atached sample TestClass, try to run it as a test
2. it with fail with an Exception:


FAILED CONFIGURATION: @BeforeMethod init
java.lang.ClassCastException:
org.mockito.internal.creation.jmock.ClassImposterizer$ClassWithSuperclassToWorkAroundCglibBug$$EnhancerByMockitoWithCGLIB$$391431f1
cannot be cast to org.SimpleA
at org.SimpleA.init(SimpleA.java:26)

What is the expected output? What do you see instead?
shouldnt throw an exception

What version of the product are you using? On what operating system?
1.8.6-SNAPSHOT, mac-osx, java:1.6.0_13

Please provide any additional information below.

Attachments:
SimpleA.java 749 bytes

moc...@googlecode.com

unread,
Apr 7, 2011, 4:23:16 AM4/7/11
to mocki...@googlegroups.com

Comment #1 on issue 251 by szcze...@gmail.com: ClassCastException when
mocking a method with a return type of List<SomeInterface>
http://code.google.com/p/mockito/issues/detail?id=251

Yeah, its a problem with deep stubs and i swear we have somewhere in the
tracker and on our radar. Unfortunately, fixing it requires a lot of
hacking due to the jdk api.

moc...@googlecode.com

unread,
Jan 13, 2012, 11:01:58 AM1/13/12
to mocki...@googlegroups.com
Updates:
Status: Duplicate
Mergedinto: 230

Comment #2 on issue 251 by brice.du...@gmail.com: ClassCastException when

mocking a method with a return type of List<SomeInterface>
http://code.google.com/p/mockito/issues/detail?id=251

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages