TeradataTimestampPeriod extends DbStruct { @Override public boolean equals(Object other) { if (other == null) return false; if (!(other instanceof TeradataTimestampPeriod)) return false; TeradataTimestampPeriod odp = (TeradataTimestampPeriod)other; Object[] thisAtts = null; Object[] otherAtts = null; try { otherAtts = odp.getAttributes(); thisAtts = this.getAttributes(); } catch (SQLException e) { System.out.println("TeradataTimestampPeriod: equals: caught exception"); } if (!(thisAtts[0].equals(otherAtts[0]))) return false; if (!(thisAtts[1].equals(otherAtts[1]))) return false; return true; } TeradataTimestampPeriod(Object[] dates); @Override String toString(); @Override boolean equals(Object other);  }
@Test public void notEqualsTest() { String fromStr = "2012-11-11 01:23:45"; String toStr = "2014-06-02 12:13:14"; java.sql.Timestamp F = null; java.sql.Timestamp T = null; try { F = (java.sql.Timestamp) SqlTimestampParseDelegate.parse(fromStr); T = (java.sql.Timestamp) SqlTimestampParseDelegate.parse(toStr); } catch (Exception e) { throw new Error("Parsing timestamp literals"); } Object[] range = { F, T }; TeradataTimestampPeriod tdp = new TeradataTimestampPeriod(range); Object[] range2 = { F, F }; TeradataTimestampPeriod tdp2 = new TeradataTimestampPeriod(range2); assertFalse("Timestamp periods are equal", tdp.equals(tdp2)); }
@Test public void equalsTest() { String fromStr = "2012-11-11 01:23:45"; String toStr = "2014-06-02 12:13:14"; java.sql.Timestamp F = null; java.sql.Timestamp T = null; try { F = (java.sql.Timestamp) SqlTimestampParseDelegate.parse(fromStr); T = (java.sql.Timestamp) SqlTimestampParseDelegate.parse(toStr); } catch (Exception e) { throw new Error("Parsing timestamp literals"); } Object[] range = { F, T }; TeradataTimestampPeriod tdp = new TeradataTimestampPeriod(range); TeradataTimestampPeriod tdp2 = new TeradataTimestampPeriod(range); assertTrue("Timestamp periods are not equal", tdp.equals(tdp2)); }