Record implements Iterable<Comparable<?>>, Serializable { @Override public boolean equals(Object obj) { if (!(obj instanceof Record)) { return false; } Record record = (Record) obj; return size() == record.size() && Arrays.equals(this.values, record.values); } Record(List<? extends Comparable<?>> values);  Record(Comparable<?>... values); T get(int index); int size(); @Override Iterator<Comparable<?>> iterator(); boolean isNumeric(int index); @Override boolean equals(Object obj); @Override String toString(); Record insert(Comparable<?> value, int position);  }
@Test public void testRecordsWithDifferentSizeAreUnequal() { Record shorterRecord = new Record(0, 1); Record longerRecord = new Record(0, 1, 2, 3); boolean equal = shorterRecord.equals(longerRecord); assertThat(equal, is(false)); }
@Test public void testRecordsWithIdenticalContentsAreEqual() { Record r1 = new Record(-3.0, 1, "SomeString", null); Record r2 = new Record(-3.0, 1, "SomeString", null); boolean equal = r1.equals(r2); assertThat(equal, is(true)); }