TeradataDatePeriod extends DbStruct { @Override public String toString() { String r = ""; try { Object[] a = super.getAttributes(); for (int i = 0; i < a.length; i++) { if (i > 0) r = r + ","; r = r + a[i].toString(); } } catch (SQLException e) { System.out.println("TeradataDatePeriod: toString: caught exception"); } return r; } TeradataDatePeriod(Object[] dates); @Override String toString(); @Override boolean equals(Object other);  }
@Test public void toStringTest() { String fromStr = "2012-11-11"; String toStr = "2014-06-02"; DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date fromDate = null; Date toDate = null; try { fromDate = dateFormat.parse(fromStr); toDate = dateFormat.parse(toStr); } catch (ParseException e) { throw new Error("TeradataDatePeriodTest: toStringTest: error parsing test input"); } Date[] range = {fromDate, toDate}; TeradataDatePeriod tdp = new TeradataDatePeriod(range); assertEquals("Date periods are not equal", fromDate.toString() + "," + toDate.toString(), tdp.toString()); }