Issue Details (XML | Word | Printable)

Key: DBUTILS-9
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Michael Schuerig
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons DbUtils

[dbutils] MockResultSet needs to handle equals and hashCode

Created: 20/Oct/04 01:45 AM   Updated: 02/Jan/08 07:29 AM
Return to search
Component/s: None
Affects Version/s: 1.0
Fix Version/s: 1.1

Time Tracking:
Not Specified

Environment:
Operating System: other
Platform: Other

Bugzilla Id: 31786


 Description  « Hide
Please amend MockResultSet#invoke like this in order to handel equals,
hashCode, and toString

public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {

String methodName = method.getName();

if (methodName.equals("getMetaData")) { //... } else if (methodName.equals("equals")) { return Boolean.valueOf(proxy == args[0]); } else if (methodName.equals("hashCode")) { return Integer.valueOf(System.identityHashCode(proxy)); } else if (methodName.equals("toString")) { return proxy.toString(); }

return null;
}

This addition makes proxies generated by MockResultSet usable in Maps. That
might not look like a big deal, but it is. Among other things, EasyMock keeps
arguments and return values in Maps. With the addition, MockResultSet proxies
can be used with mock objects created by EasyMock.

Michael



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell made changes - 16/May/06 09:47 AM
Field Original Value New Value
issue.field.bugzillaimportkey 31786 12341812
Henri Yandell made changes - 16/May/06 11:29 AM
Project Commons [ 12310458 ] Commons DbUtils [ 12310470 ]
Component/s DbUtils [ 12311110 ]
Affects Version/s 1.0 Final [ 12311651 ]
Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
Key COM-1660 DBUTILS-9
Henri Yandell made changes - 16/May/06 12:19 PM
Affects Version/s 1.0 Final [ 12311724 ]
Henri Yandell made changes - 06/Jul/06 11:36 AM
Fix Version/s 1.1 [ 12311973 ]
Henri Yandell made changes - 02/Jan/08 07:29 AM
Status Resolved [ 5 ] Closed [ 6 ]