If you use the MXUnit testing framework for ColdFusion, you might have come across this earlier — the assertEquals assertion is case-insensitive.
This means that if you try and compare a string like ‘abs’ and ‘Abs’, assertEquals returns true.
And that is ok in certain cases, but is not ok in many other. I guess it boils down to the fact that at the end of the day, ColdFusion is case-insensitive. A variable called ‘firstName’ is the treated the same as ‘FirstName’.
But enough of that.
So how do you test for case-sensitivity in assertEquals assertion?
First I thought I’d write my own assertion. But then there is a much simpler solution. Simply hash the the two strings that one needs to compare and assert that they are NOT equal.
So rather than:
It works quite nicely.
Do you do it differently?
BTW, there some discussion of this on the MXUnit Google Groups as well.