[
https://issues.jboss.org/browse/TEIIDDES-1681?page=com.atlassian.jira.plu...
]
Paul Richardson commented on TEIIDDES-1681:
-------------------------------------------
As an OSGI plugin, mockito is loaded, as a dependency by the first junit test bundle.
Thereafter, it is relied on by all subsequent unit test plugins.
Mockito employs objensis to cache mocked classes. In the case of mocking classes from the
teiid runtimes, such as Admin, the mocked instance is cached against its class and package
name. However, for the teiid runtime plugins, the package and class names are largely
identical so there is a danger of an existing class (from the wrong runtime) being
returned from the cache rather than creating a new one (from the correct runtime).
Thus, tests based on one version of the runtime client will cache its mocked classes then
subsequent tests based on the second runtime client fail since attempts to mock its
classes return the wrong mocked classes from the cache, resulting in ClassCastExceptions.
The workaround is to turn the objensis cache off. Mockito 1.9 allows this by adding a
Configuration class to the set of tests. This class is loaded by mockito by asking the
system classloader for any classes implementing IMockitoConfiguration. However, due to
eclipse's bundle class loading system it is impossible for Mockito to uniformly detect
a Configuration class, in a test plugin, that will get loaded by the mockito plugin's
class loader.
To solve this, the Mockito plugin has been modified to include an additional Configuration
class. This class can be called explicitly (at the start of the test-cycle) and provides
setters for changing configuration options, including turning off the objensis cache.
Mockito tests selecting incorrect teiid runtime client
------------------------------------------------------
Key: TEIIDDES-1681
URL:
https://issues.jboss.org/browse/TEIIDDES-1681
Project: Teiid Designer
Issue Type: Sub-task
Components: Testing
Reporter: Paul Richardson
Assignee: Paul Richardson
Fix For: 8.1
Executing all tests in Eclipse results in mockito-related tests choosing the incorrect
teiid runtime client, resulting in tests failing with unexpected results.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira