You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Anish Doshi (JIRA)" <ji...@apache.org> on 2017/08/25 04:45:00 UTC

[jira] [Comment Edited] (TINKERPOP-1756) I wish Cluster was an interface so that I could mock it

    [ https://issues.apache.org/jira/browse/TINKERPOP-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16141202#comment-16141202 ] 

Anish Doshi edited comment on TINKERPOP-1756 at 8/25/17 4:44 AM:
-----------------------------------------------------------------

Thanks for the quick response [~spmallette]. Appreciate it.

We are not really using client at all. We only create a {{GraphTraversalSource}} by calling {{graph.traversal().withRemote(DriverRemoteConnection.using(this.cluster, "g"))}} to traverse the graph. For this, we would like to pass in a mock {{Cluster}}. So this was the issue that we faced.

There are well documented reasons why PowerMock should not be used:
* https://stackoverflow.com/questions/30162200/why-not-powermock
* http://automationrhapsody.com/powermock-examples-better-not-use/

And we do not intend to use PowerMock just to mock {{Cluster}}. PowerMock normalises bad designs and we would like to refrain from using it.

Mockito doesn't allow mocking final classes since it sub-classes the class that you are attempting to mock.


was (Author: anishdoshi):
Thanks for the quick response [~spmallette]. Appreciate it.

We are not really using client at all. We only create a {{GraphTraversalSource}} by calling {{graph.traversal().withRemote(DriverRemoteConnection.using(this.cluster, "g"))}} to traverse the graph. For this, we would like to pass in a mock {{Cluster}}. So this was the issue that we faced.

There are well documented reasons why PowerMock should not be used:
* https://stackoverflow.com/questions/30162200/why-not-powermock
* http://automationrhapsody.com/powermock-examples-better-not-use/

And we do not intend to use PowerMock just to mock {{Cluster}}. PowerMock normalises bad designs and we would like to refrain from using it.

> I wish Cluster was an interface so that I could mock it
> -------------------------------------------------------
>
>                 Key: TINKERPOP-1756
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1756
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: driver
>    Affects Versions: 3.2.4
>            Reporter: Anish Doshi
>
> {{org.apache.tinkerpop.gremlin.driver.Cluster}} is currently a final class. Which means that every time I need to mock this class, I cannot. I have to create a separate object and mock that object instead of mocking {{Cluster}}.
> Is there a chance that Cluster can be changed to an interface, or at least not have as a {{final}} class?
> Thanks.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)