/** {@inheritDoc} */ @SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"}) @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestObject that = (TestObject) o; if (id != that.id) return false; if (!Arrays.equals(arrVal, that.arrVal)) return false; if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false; if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false; if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false; if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false; if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false; if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false; if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false; if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false; if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false; if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false; if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false; if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false; if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false; if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false; if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false; if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false; return true; }
/** {@inheritDoc} */ @SuppressWarnings("EqualsHashCodeCalledOnUrl") @Override public int hashCode() { int res = id; res = 31 * res + (boolVal != null ? boolVal.hashCode() : 0); res = 31 * res + (byteVal != null ? byteVal.hashCode() : 0); res = 31 * res + (shortVal != null ? shortVal.hashCode() : 0); res = 31 * res + (intVal != null ? intVal.hashCode() : 0); res = 31 * res + (longVal != null ? longVal.hashCode() : 0); res = 31 * res + (floatVal != null ? floatVal.hashCode() : 0); res = 31 * res + (doubleVal != null ? doubleVal.hashCode() : 0); res = 31 * res + (bigVal != null ? bigVal.hashCode() : 0); res = 31 * res + (strVal != null ? strVal.hashCode() : 0); res = 31 * res + (arrVal != null ? Arrays.hashCode(arrVal) : 0); res = 31 * res + (dateVal != null ? dateVal.hashCode() : 0); res = 31 * res + (timeVal != null ? timeVal.hashCode() : 0); res = 31 * res + (tsVal != null ? tsVal.hashCode() : 0); res = 31 * res + (urlVal != null ? urlVal.hashCode() : 0); res = 31 * res + (f1 != null ? f1.hashCode() : 0); res = 31 * res + (f2 != null ? f2.hashCode() : 0); res = 31 * res + (f3 != null ? f3.hashCode() : 0); return res; }
/** @throws Exception If failed. */ public void testObject() throws Exception { ResultSet rs = stmt.executeQuery(SQL); TestObjectField f1 = new TestObjectField(100, "AAAA"); TestObjectField f2 = new TestObjectField(500, "BBBB"); TestObject o = createObjectWithData(1); assertTrue(rs.next()); assertEquals(f1.toString(), rs.getObject("f1")); assertEquals(f1.toString(), rs.getObject(16)); assertEquals(f2.toString(), rs.getObject("f2")); assertEquals(f2.toString(), rs.getObject(17)); assertNull(rs.getObject("f3")); assertTrue(rs.wasNull()); assertNull(rs.getObject(18)); assertTrue(rs.wasNull()); assertEquals(o.toString(), rs.getObject("_val")); assertEquals(o.toString(), rs.getObject(19)); assertFalse(rs.next()); }