public void testAttachDetach() {
myArray.add(10);
LongCyclicQueue.PinnedIterator it = myArray.pinnedIterator();
checkRemoveAndCatchISE(myArray, -1);
assertEquals(10, it.nextValue());
it.detach();
myArray.removeFirst();
assertEquals(10, it.value());
myArray.addAll(LongArray.create(11, 12, 13, 14, 15).iterator());
CHECK.order(myArray, 11, 12, 13, 14, 15);
myArray.removeFirst();
myArray.add(16);
CHECK.order(myArray, 12, 13, 14, 15, 16);
assertEquals(16, it.value());
it.attach();
assertEquals(16, it.value());
assertFalse(it.hasNext());
checkRemoveAndCatchISE(myArray, -2);
checkRemoveAndCatchISE(myArray, 5);
myArray.removeFirst(4);
myArray.add(17);
assertTrue(it.hasNext());
assertEquals(17, it.nextValue());
assertFalse(it.hasNext());
}