hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HBASE-8673) Make code involving class.getMethod() more amenable to mocking
Date Mon, 03 Jun 2013 04:05:20 GMT

     [ https://issues.apache.org/jira/browse/HBASE-8673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

stack resolved HBASE-8673.

    Resolution: Invalid

Resolving trivial, issue w/o description of why it needs to be fixed nor of how it is to be

I also believe this a non-issue.  See hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSHDFSUtils.java
for example of how to mock a DFS with a method that may or may not be present.
> Make code involving class.getMethod() more amenable to mocking
> --------------------------------------------------------------
>                 Key: HBASE-8673
>                 URL: https://issues.apache.org/jira/browse/HBASE-8673
>             Project: HBase
>          Issue Type: Test
>            Reporter: Ted Yu
>            Priority: Minor
> In some place, such as the following (FSUtils#isInSafeMode), we retrieve method using
getMethod() with hardcoded class name:
> {code}
>   private static boolean isInSafeMode(DistributedFileSystem dfs) throws IOException {
>     boolean inSafeMode = false;
>     try {
>       Method m = DistributedFileSystem.class.getMethod("setSafeMode", new Class<?>
> {code}
> The above code is not friendly to mocking.
> The test class may define its own DistributedFileSystem descendent class and pass an
instance to FSUtils#isInSafeMode(). In that case, assertion similar to the following would
> {code}
>     Mockito.verify(dfs, Mockito.times(1)).setSafeMode();
> {code}

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

View raw message