You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by sebb <se...@gmail.com> on 2010/04/21 01:31:31 UTC

Test classes - use assertEquals(exp,act) instead of assertTrue(actual=expected)?

I just changed TestIdentityInputStream to use assertEquals(exp,actual)
rather than assertTrue(actual==exp), as this shows the actual and
expected values if the test fails.

Any objections if I work through the other test classes doing the same?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Test classes - use assertEquals(exp,act) instead of assertTrue(actual=expected)?

Posted by sebb <se...@gmail.com>.
On 21/04/2010, Mike Dillon <mi...@embody.org> wrote:
> Shouldn't that be assertSame() to retain the meaning of "=="?

In this case, the operands were primitives (int/long) which are not
supported by assertSame().

But agreed - assertSame() would be needed for object comparisons.

>  -md
>
>
>  "sebb" <se...@gmail.com> wrote:
>
>  >I just changed TestIdentityInputStream to use assertEquals(exp,actual)
>  >rather than assertTrue(actual==exp), as this shows the actual and
>  >expected values if the test fails.
>  >
>  >Any objections if I work through the other test classes doing the same?
>  >
>
> >---------------------------------------------------------------------
>  >To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>  >For additional commands, e-mail: dev-help@hc.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>  For additional commands, e-mail: dev-help@hc.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Test classes - use assertEquals(exp,act) instead of assertTrue(actual=expected)?

Posted by Mike Dillon <mi...@embody.org>.
Shouldn't that be assertSame() to retain the meaning of "=="?

-md

"sebb" <se...@gmail.com> wrote:

>I just changed TestIdentityInputStream to use assertEquals(exp,actual)
>rather than assertTrue(actual==exp), as this shows the actual and
>expected values if the test fails.
>
>Any objections if I work through the other test classes doing the same?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>For additional commands, e-mail: dev-help@hc.apache.org
>

Re: Test classes - use assertEquals(exp,act) instead of assertTrue(actual=expected)?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2010-04-21 at 00:31 +0100, sebb wrote:
> I just changed TestIdentityInputStream to use assertEquals(exp,actual)
> rather than assertTrue(actual==exp), as this shows the actual and
> expected values if the test fails.
> 
> Any objections if I work through the other test classes doing the same?
> 

None at all

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org