mercredi 27 juillet 2016

Java: Mocked object is not the same as itself?

I'm using JMockit and doing some JUnit testing and have encountered this complaint from assertSame(mockExpected, callMyMethod()) where callMyMethod returns the mockExpected object.

java.lang.AssertionError: expected same:<com.MINE.common.java.xml.XmlNode@9eb67cb> was not:<com.MINE.common.java.xml.XmlNode@9eb67cb>

Is there some limitation on checking against mocked objects like this? I have other tests in the same module that compare in this manner and they work fine.

Aucun commentaire:

Enregistrer un commentaire