New answers tagged

0

assertEquals is specifically for comparison between two objects (strings, integers or any class objects). Whereas, assertTrue is more generic in the sense that it asserts any condition with boolean value true. Still, it boils down to semantic from software testing solutions perspective as both can be used in each other's stead. For example, you can do ...


0

It is all about semantic.. Your tests should be logical and readable. If your criterion is boolean, there is no need to use complex constructions. That's much like when you use if. Instead of if(val == true){} you will likely use if (val){}. Using assertEquals makes sense when you deal with complex structures.


1

assertEquals will give you more information for example if you compare a and b, it will show which one is bigger. But assertTrue will only show the result, like expected true, found false.


Top 50 recent answers are included