You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "stack (JIRA)" <ji...@apache.org> on 2013/06/03 06:05:20 UTC
[jira] [Resolved] (HBASE-8673) Make code involving
class.getMethod() more amenable to mocking
[ 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 fixed.
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 fail:
> {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