Bill,
Two thoughts:
1) Often times, if JUnit indicates two identical strings but claims
they're not equal, it's a type problem. For example, I'll get this if
I say:
assertEquals("<1, 2, 3>", myCollection);
rather than:
assertEquals("<1, 2, 3>", myCollection.toString());
2) The empty square brackets are a rare specimen. What version of
JUnit are you using? Can you boil your test down into code we could
legally compile and examine? Thanks,
David Saff
On Thu, Oct 22, 2009 at 3:36 PM, txbuckeye2002 <
txbuckeye2002@...> wrote:
> Hello,
>
> I have gotten some strange error/failure messages with square braces in my strings. I have searched through the forum and don't seem to find any similar issue.
>
> I have a test that failed but should have passed. The output goes like this:
>
> / Exclamation \ testToString_0args caused an error (expected:<10.00000 []30.00000> but was :<10.00000 []30.00000>)
> -expected:<10.00000 []30.00000> but was :<10.00000 []30.00000>
> -org.junit.ComparisonFailure
> -at touchstone.DataTest.testToString_0args
>
> I put some System.out.println statements in my test to make sure the strings matched and they do:
>
> toString
> result = 10.00000 30.00000
> expResult = 10.00000 30.00000
>
> So I'd like to know where the [] came from in the line
> expected:<10.00000 []30.00000> but was :<10.00000 []30.00000>
> plus why would this fail?
>
> Thank you,
> Bill
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>