16 Jul 20:37
mocking concrete classes with final toString method
From: Haroon Rafique <haroon.rafique@...>
Subject: mocking concrete classes with final toString method
Newsgroups: gmane.comp.java.jmock.user
Date: 2008-07-16 18:39:04 GMT
Subject: mocking concrete classes with final toString method
Newsgroups: gmane.comp.java.jmock.user
Date: 2008-07-16 18:39:04 GMT
Hi there, I'm using jmock 2.5.0RC1. When trying to mock concrete classes with final toString methods, I'm getting: java.lang.IllegalArgumentException: ClassNameHere has a final toString method Looking through jira and the changelogs, this is a direct result of this bug: http://jira.codehaus.org/browse/JMOCK-150 and was implemented in changeset: http://fisheye.codehaus.org/changelog/jmock?cs=1152 Is there a middle ground somewhere? I'm working with 3rd party classes where I have no control over their class structure. JMOCK-150 seems like squashing a bug with a hammer. The original bug reporter mentioned that: * an un-expected exception during the assertIsSatisfied() check (got the exception when tring to describe the mocked class using the final toString() which uses other methods from the original class) Could the code in Mockery.assertIsSatisfied() look for the fact that a ClassImposteriser is being used and to bypass the toString method in case it is final? pseudo-code follows: new ExpectationError("not all expectations were satisfied",(Continue reading)
RSS Feed