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

Todd Lipcon commented on HADOOP-7537:
-------------------------------------

The way we've mocked things like this in HBase is to use a class called 
"EnvironmentEdge". The default implementation simply forwards calls to the 
normal JVM implementations (eg envEdge.currentTimeMillis() calls 
System.currentTimeMillis()). It's then easy to mock this by replacing an 
instance within a particular class with a mock. Could we do the same thing with 
the construction of InetSocketAddress?

> Add PowerMock for the development of better tests
> -------------------------------------------------
>
>                 Key: HADOOP-7537
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7537
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: build
>    Affects Versions: 0.23.0
>            Reporter: Kihwal Lee
>            Assignee: Kihwal Lee
>            Priority: Minor
>             Fix For: 0.23.0
>
>         Attachments: powermock.patch
>
>
> We already have Mockito, but PowerMock extends its capabilties so that we can 
> mock constructors and static methods. I find that it is extremely difficult, 
> if not impossible, to properly test some of the low-level features without 
> this. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to