Forum Discussion
Taz
Contributor
Not sure how this answers my question. The problem is that I try to avoid extra work to assert a variable having to do anything. Groovy seems to be strange that it treats the original variable different when it is copied into another. As you can see from the examples I have given, it is both times the exact same test. The only difference that when I use the original variable for assert, it also displays a lot of junk after it, but when I copy it into another variable first and then do an assert, it doesn't. I just wonder if there is something that can be done to stop this behaviour.
nmrao
2 years agoChampion Level 3
There is little misread from my end. Thought you are saying the assert default message as junk and missed the main point.
The reason for assert failure is comparing different data types i.e., string vs decimal number.
Try to compare the data of same type, otherwise cast before compare.
The reason for assert failure is comparing different data types i.e., string vs decimal number.
Try to compare the data of same type, otherwise cast before compare.