equals() testing using GSBase

GSBase

During the unit testing, you often come to a point where you have to test your equals() methods. Instead of hardcoding the various aspects, you can use GSBase. GSBase is a very handy tool to test your equals() (among other things). It tests the equivalence relation according to 4 principles:

  • reflexive

  • symmetric

  • transitive

  • consistent



Have a look at it! It's very easy to use. All you have to do is to use the EqualsTester class:

final Car car1 = new Car();
final Car car2 = new Car();
final Car car3 = new Car("green", 4, "02 D 12345");
final Car car4 = new Car("black", 2, "04 C 1234") {};
new EqualsTester(car1, car2, car3, car4);

Comments