Cannot use Mockito to Mock Events; result is ClassCastException
---------------------------------------------------------------
Key: JBRULES-3245
URL:
https://issues.jboss.org/browse/JBRULES-3245
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (fusion)
Affects Versions: 5.3.0.CR1
Environment: Java 1.6, Windows
Reporter: Rob Crawford
Assignee: Mark Proctor
Attachments: mocktest.zip
AbstractRuleBase.getTypeDeclaration(Class clazz) cannot determine what type is being
mocked, so attempting to mock an event causes the system to fall back to the object being
a simple fact. Have test classes to attach to issue: explanation of what I'm seeing:
testMockObjectAsEvent: may not be the same issue, but the system cannot identify the
correct extractor for the event timestamp, and attempts to get a Long value from a method
that returns a Date. In this case, it's at least identified as an event.
testMockObjectAsEventTwoLevels: mock is of an interface that extends a declared event; in
this case the mock is never identified as an event, but still follows the path into the
rule's window function, resulting in an attempt to cast the mock's
DefaultFactHandle to an EventFactHandle.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira