[
https://issues.apache.org/jira/browse/HADOOP-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239171#comment-13239171
]
Todd Lipcon commented on HADOOP-8218:
-------------------------------------
bq. Todd, can the mock object implement a new interface that extends
HAServiceProtocol and Closeable? Will that solve the problem?
That avoids the advanced syntax, but requires that you make such a fake
interface everywhere you mock a protocol, which again is somewhat
counter-intuitive.
bq. #2 makes the main code aware of test specifics, which isn't a good idea.
How about doing #3 by creating a helper method that encapsulates that code in
one place?
I was thinking about doing that... ie a
MockitoUtils.mockIpcProtocol(FooProtocol.class). Since it seems people like
this idea better than #2, I'll prepare such a patch.
> RPC.closeProxy shouldn't throw error when closing a mock
> --------------------------------------------------------
>
> Key: HADOOP-8218
> URL: https://issues.apache.org/jira/browse/HADOOP-8218
> Project: Hadoop Common
> Issue Type: Bug
> Components: ipc, test
> Affects Versions: 0.24.0
> Reporter: Todd Lipcon
> Assignee: Todd Lipcon
> Priority: Critical
> Attachments: hadoop-8218.txt
>
>
> HADOOP-8202 changed the behavior of RPC.stopProxy() to throw an exception if
> called on an object which doesn't implement Closeable. Unfortunately, we use
> mock objects in many test cases, and those mocks don't implement Closeable.
> This is causing TestZKFailoverController to fail in trunk, for example.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira