Post by a***@securifi.comI have a similar problem
Genericindex a;
Genericindex b;
a= datafrommethod();//returns object of Genericindex
b= datafrommethod();//returns object of Genericindex
b= anothermethod(b);//some object might be overriden
if(notoverridden){
assertEquals(a,b);}// this fails
can someone explain this?
There's not enough information for a full explanation -- in
particular, we don't know what datafrommethod() does, nor what
anothermethod() does. However, if the assertEquals() reports a
failure, what we *do* know is
1) At least one of `a' and `b' is non-null, because if both
were null assertEquals() would not fail. (It considers two
null references to be "equal.")
2) If `a' is null then `b' is non-null. Similarly, if `b'
is null then `a' is non-null. Either way, `a' and `b' are
unequal: One points to an object, and the other is null.
3) If both `a' and `b' are non-null, then they point to
two objects that are not equal according to the equals() method.
This might be the equals() method of GenericIndex itself, or of
a subclass of GenericIndex (if `a' or `b' points to a subclass
instance), or an equals() method that GenericIndex inherits
from one of its superclasses (perhaps java.lang.Object).
... and that's really all I can discern from what you've
provided. If I knew more about about datafrommethod(), about
anothermethod(), and about GenericIndex and its sub- and
super-classes, I might be able to explain more fully.
--
***@comcast-dot-net.invalid
Thirteen hundred sixty-three days to go.