### Question:
ObjectList { public static Object clone (Object head) throws CloneNotSupportedException { if (head instanceof Node){ return cloneNode( (Node)head); } else if (head != null){ return cloneData( head); } else { return null; } } private  ObjectList(); static Iterator iterator(Object head); static TypedIterator<A> typedIterator(Object head, Class<A> type); static Object createList(Object... values); static Object valueOf(Object o); static Object set(Object head, Object newHead); static Object forceSet(Object head, Object newHead); static Object add(Object head, Object data); static Object replace(Object head, Object oldData, Object newData); static Object remove(Object head, Object data); static boolean contains(Object head, Object o); static boolean containsType(Object head, Class<?> type); static boolean isList(Object head); static boolean isEmpty(Object head); static int size(Object head); static int numberOfInstances(Object head, Class<?> type); static Object get(Object head, int idx); static Object getFirst(Object head); static Object getNext(Object head, Object prevData); static A getFirst(Object head, Class<A> type); static A getNext(Object head, Class<A> type, Object prevData); static void hash(Object head, HashData hd); static boolean equals( Object head1, Object head2); static Object clone(Object head);  }### Answer:
@Test public void testClone(){ Object l1, l1c, l2; l1 = ObjectList.createList(new A("one"), new A("two")); l2 = ObjectList.createList(new A("one_clone"), new A("two_clone")); try { l1c = ObjectList.clone(l1); assertTrue( ObjectList.equals(l1c, l2)); } catch (CloneNotSupportedException cnsx){ fail("A.clone() did throw CloneNotSupportedException"); } l1 = "one"; l2 = "one_clone"; try { l1c = ObjectList.clone(l1); fail("Strings are not cloneable"); } catch (CloneNotSupportedException cnsx){ } l1 = new A("one"); try { l1c = ObjectList.clone(l1); assertTrue( l1.equals( new A("one"))); } catch (CloneNotSupportedException cnsx){ fail("object clone failed"); } l1 = null; try { l1c = ObjectList.clone(l1); assertTrue( l1c == null); } catch (CloneNotSupportedException cnsx){ fail("empty list clone failed"); } l1 = new B("one"); try { l1c = ObjectList.clone(l1); assertTrue( l1.equals( new B("one"))); } catch (CloneNotSupportedException cnsx){ fail("object clone failed"); } l1 = ObjectList.createList(new B("one"), new B("two")); l2 = ObjectList.createList(new A("one_clone"), new A("two_clone")); try { l1c = ObjectList.clone(l1); assertTrue( ObjectList.equals(l1c, l2)); } catch (CloneNotSupportedException cnsx){ fail("B.clone() did throw CloneNotSupportedException"); } }