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

stack commented on HBASE-5456:
------------------------------

I don't think that this is the kind of thing you can do by fiat.  My take is 
that we'll use PowerMock when it makes sense (apart from the fact that 
PowerMock isn't exactly a walk-in-the-park).

My current take on testing in hbase is that so much of our code base is test 
inscrutable and that anything we can do to shine light on these untested 
savannas of code is good by me, even unto adding public methods that allow 
injection of alternate classes.
                
> Introduce PowerMock into our unit tests to reduce unnecessary method exposure
> -----------------------------------------------------------------------------
>
>                 Key: HBASE-5456
>                 URL: https://issues.apache.org/jira/browse/HBASE-5456
>             Project: HBase
>          Issue Type: Task
>            Reporter: Zhihong Yu
>
> We should introduce PowerMock into our unit tests so that we don't have to 
> expose methods intended to be used by unit tests.
> Here was Benoit's reply to a user of asynchbase about testability:
> OpenTSDB has unit tests that are mocking out HBaseClient just fine
> [1].  You can mock out pretty much anything on the JVM: final,
> private, JDK stuff, etc.  All you need is the right tools.  I've been
> very happy with PowerMock.  It supports Mockito and EasyMock.
> I've never been keen on mutilating public interfaces for the sake of
> testing.  With tools like PowerMock, we can keep the public APIs tidy
> while mocking and overriding anything, even in the most private guts
> of the classes.
>  [1] 
> https://github.com/stumbleupon/opentsdb/blob/master/src/uid/TestUniqueId.java#L66

--
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

        

Reply via email to