0

I have a problem with AssertEquals in JUnit because i try to compare two istance of objects , i get this error :

java.lang.AssertionError: expected: com.euris.Price<Price [1p 19s 2d -2a]> but was: com.euris.Price<Price [1p 19s 2d -2a]>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.euris.exercise.ExerciseApplicationTests.contextLoads(ExerciseApplicationTests.java:31)
mework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)

Can anyone help me ?

user2462353
  • 57
  • 1
  • 10

1 Answers1

0

I think the problem here is Price is a custom Object you have to override equals method for AssertEquals to work . I hope this link helps.

Gagan Chouhan
  • 312
  • 1
  • 6