### Question:
ArrayListWritableComparable extends ArrayList<E> implements WritableComparable<ArrayListWritableComparable<E>> { public String toString() { StringBuffer sb = new StringBuffer(); sb.append("["); for (int i = 0; i < this.size(); i++) { if (i != 0) sb.append(", "); sb.append(this.get(i)); } sb.append("]"); return sb.toString(); } ArrayListWritableComparable();  ArrayListWritableComparable(ArrayList<E> array); void readFields(DataInput in); void write(DataOutput out); int compareTo(ArrayListWritableComparable<E> obj); String toString();  }### Answer:
@Test public void testBasic() throws IOException { ArrayListWritableComparable<Text> list = new ArrayListWritableComparable<Text>(); list.add(new Text("hi")); list.add(new Text("there")); assertEquals(list.get(0).toString(), "hi"); assertEquals(list.get(1).toString(), "there"); }
@Test public void testToString() { ArrayListWritableComparable<Text> list = new ArrayListWritableComparable<Text>(); list.add(new Text("hi")); list.add(new Text("there")); assertEquals(list.toString(), "[hi, there]"); }