JUnit は、テストが失敗したと言っています。ただし、違いを見るリンクを押すと、内容が同一であることがわかります。では、2 つのオブジェクトが同じであるのに、なぜテストが失敗するのでしょうか?
私が実行しているテスト。
Assert.assertSame(card,vCardService.DecodeVCard(text));
これは、「違いを見る」リンクを押すと表示されます
エラー。
Expected :Card [CardId=1, UserId=0, FirstName=Joel, LastName=Dean, WorkNumber=18769023684, CellNumber=18765757810, Email=jdeanjj1000@gmail.com, Title=Mr., UserProfileImageUrl=null, CompanyName=Xormis, CompanyAddress=null, CompanyLatitude=0.0, CompanyLongitude=0.0, LogoUrl=null, QrCodeUrl=null, QrVCardUrl=null, VCardUrl=null, FacebookUrl=null, Website=null, ShareCount=0]
Actual :Card [CardId=1, UserId=0, FirstName=Joel, LastName=Dean, WorkNumber=18769023684, CellNumber=18765757810, Email=jdeanjj1000@gmail.com, Title=Mr., UserProfileImageUrl=null, CompanyName=Xormis, CompanyAddress=null, CompanyLatitude=0.0, CompanyLongitude=0.0, LogoUrl=null, QrCodeUrl=null, QrVCardUrl=null, VCardUrl=null, FacebookUrl=null, Website=null, ShareCount=0]
<Click to see difference>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotSame(Assert.java:737)
at org.junit.Assert.assertSame(Assert.java:680)
at org.junit.Assert.assertSame(Assert.java:691)
at com.grikly.app.test.VCardServiceTest.testDecodeVCard(VCardServiceTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)