XAExceptionFactory extends AbstractExceptionFactory<XAException> { @Override public boolean equals(XAException exception1, XAException exception2) { if ((exception1.errorCode != 0) || (exception2.errorCode != 0)) { return exception1.errorCode == exception2.errorCode; } return super.equals(exception1, exception2); } XAExceptionFactory(); @Override XAException createException(String message); @Override boolean equals(XAException exception1, XAException exception2); @Override boolean indicatesFailure(XAException exception, Dialect dialect); @Override ExceptionType getType(); @Override boolean correctHeuristic(XAException exception, Phase phase);  }
@Test public void equals() { assertTrue(this.factory.equals(new XAException(), new XAException())); assertTrue(this.factory.equals(new XAException(XAException.XA_HEURCOM), new XAException(XAException.XA_HEURCOM))); assertFalse(this.factory.equals(new XAException(XAException.XA_HEURCOM), new XAException(XAException.XA_HEURHAZ))); assertTrue(this.factory.equals(new XAException("reason"), new XAException("reason"))); assertFalse(this.factory.equals(new XAException("reason"), new XAException())); assertFalse(this.factory.equals(new XAException("reason1"), new XAException("reason2"))); }