0x45
0x45

Reputation: 31

Compare two Strings to be equal

I've got two strings:

ISI_ISTP_20161213_9ec83b6e68b74e859741ce731e866236_wrk.xml
ISI_ISTP_20161212_9ec83b6e68b74e859741ce731e866236_wrk.xml

And my Test, tests if those strings are equal:

assertFalse("Tatsaechliches Ergebnis weicht nicht von 
'" + expectedResult + "' ab!", result.equals(expectedResult));

Unfortunately this test passes to be equal, but obviously it isnt. Can anybody help me?

Upvotes: 0

Views: 69

Answers (2)

saeid rastak
saeid rastak

Reputation: 353

you must use this for your purpose:

assertTrue("Tatsaechliches Ergebnis weicht nicht von 
'" + expectedResult + "' ab!", result.equals(expectedResult));

Upvotes: 0

XtremeBaumer
XtremeBaumer

Reputation: 6435

maybe because you use assertFalse. thats why the test return true, because the testcase is true. the string arent equal thats why the test is true. use assertTrue to get another result

Upvotes: 2

Related Questions