hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akira Ajisaka (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14188) Remove the usage of org.mockito.internal.util.reflection.Whitebox
Date Fri, 24 Mar 2017 06:48:41 GMT

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

Akira Ajisaka commented on HADOOP-14188:

Thanks [~ozawa] for the comment. Using Whitebox is a bad practice and that's why it was removed.
* We need to take care of the name of the field. If the name is changed, the test code can
be compiled but runtime error happens.
* Using Whitebox means the production code is not testable. We need to refactor the code instead
of the hack.

However, I agreed with porting Whitebox class as a temporal solution because this solution
breaks encapsulation. Adding getter/setter methods should be done judiciously.

Now I'd like to port the class and then upgrade Mockito to 2.x, and then we gradually and
carefully refactor the code to remove the usage of Whitebox.

> Remove the usage of org.mockito.internal.util.reflection.Whitebox
> -----------------------------------------------------------------
>                 Key: HADOOP-14188
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14188
>             Project: Hadoop Common
>          Issue Type: Test
>          Components: test
>            Reporter: Akira Ajisaka
>            Assignee: Akira Ajisaka
>            Priority: Minor
>         Attachments: HADOOP-14188.01.patch, HADOOP-14188.02.patch
> org.mockito.internal.util.reflection.Whitebox was removed in Mockito 2.1, so we need
to remove the usage to upgrade Mockito. Getter/setter method can be used instead of this hack.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org

View raw message