You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Kai Zheng (JIRA)" <ji...@apache.org> on 2016/01/07 07:31:39 UTC

[jira] [Commented] (HADOOP-12693) Many misusage of assertEquals(expected, actual)

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

Kai Zheng commented on HADOOP-12693:
------------------------------------

This can be corrected incrementally. For the long term, I would suggest we introduce [AssertJ|http://joel-costigliola.github.io/assertj/] for the new tests avoiding such mistakes.

> Many misusage of assertEquals(expected, actual)
> -----------------------------------------------
>
>                 Key: HADOOP-12693
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12693
>             Project: Hadoop Common
>          Issue Type: Test
>            Reporter: Akihiro Suda
>            Priority: Trivial
>         Attachments: just-rough-approx.txt
>
>
> The first arg of {{org.JUnit.Assert.assertEquals()}} should be an {{expected}} value, and the second one should be an {{actual}} value.
> {code}
> void assertEquals(T expected, T actual);
> {code}
> http://junit.org/apidocs/org/junit/Assert.html#assertEquals(java.lang.Object, java.lang.Object)
> However, there are so many violations in Hadoop, which can make a misleading message like this:
> {code}
> AssertionError: expected:<actual> but was:<expected>
> {code}.
> Please refer to {{just-rough-approx.txt}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)