hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Lu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-7537) Add PowerMock for the development of better tests
Date Tue, 23 Aug 2011 20:10:29 GMT

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

Luke Lu commented on HADOOP-7537:
---------------------------------

bq. It requires mocking the constructor of InetSocketAddress.

Instead of introducing PowerMock, which can lead to test failures in unrelated tests. How
about just introduce an InetSocketAddress factory? In this particular case, what you really
want to control is the DNS resolution. How about just introduce a NodeNameResolver interface
and a DefaultNodeNameResolver singleton to manage the resolver (so you can use a test resolver
to supply mocks)?

If we find that we need to do too many such exercises, we'd better off using a complete (but
still lightweight) DI solution like Guice (which can be introduced into our code incrementally),
which is already a maven dependency in our code base :)

> 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

        

Mime
View raw message