0

I am using a generic Pair class which I took from here Generic pair class

Now I need to write unit tests for each method of the class. For these tests I wrote for example:

Pair p1 = new Pair("a",2);
Assert.assertEquals("(a,2)", p1.toString());`

My tests are failing with the following message. Could anyone help me how to overcome this issue for both the unit test and the program itself? I am very new at Java, and I couldn't find anything to solve this problem.

expected:<[(1,2)]> but was:<[Pair@58d25a40]>
    [junit] junit.framework.AssertionFailedError: expected:<[(1,2)]> but was:<[Pair@58d25a40]>
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
kneazle
  • 335
  • 4
  • 14

0 Answers0