24 February 2012

Validating Strings with .equals

I was making some assertions lately, and one of the dev's here gave me some advice.

My assertions in GEB were like this:
$("td.header", 0).text() == ("Occupation:")

But I was advised that using == is when checking an Object.  When checking a string, I should use .equals.

So instead I used:
$("td.header", 0).text().equals("Occupation:")

No comments:

Post a Comment