use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistListIteratorWithIndexConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistListIteratorWithIndexConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.add(SYSTEM.newInt(99));
sublist.listIterator(1);
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteTestCase method retainAllReadOnly.
@Test(expected = ReadOnlyValueException.class)
public void retainAllReadOnly() {
final IonSequence sequence = newEmptySequence();
sequence.makeReadOnly();
sequence.retainAll(Collections.emptyList());
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteTestCase method retainAllUsesReferenceEquality.
@Test
public void retainAllUsesReferenceEquality() {
final IonSequence sequence = newEmptySequence();
final ArrayList<IonValue> toRetain = new ArrayList<IonValue>();
final IonValue value = SYSTEM.newInt(1);
sequence.add(value);
final IonValue equalValue = SYSTEM.newInt(1);
toRetain.add(equalValue);
assertEquals(equalValue, value);
assertNotSame(equalValue, value);
assertTrue(sequence.retainAll(toRetain));
assertEquals(0, sequence.size());
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteTestCase method retainAll.
@Test
public void retainAll() {
final IonSequence sequence = newEmptySequence();
final ArrayList<IonValue> toRetain = new ArrayList<IonValue>();
final IonValue retainedValue = SYSTEM.newInt(1);
sequence.add(retainedValue);
toRetain.add(retainedValue);
final IonValue toRemoveValue = SYSTEM.newInt(2);
sequence.add(toRemoveValue);
assertTrue(sequence.retainAll(toRetain));
assertEquals(1, sequence.size());
assertTrue(sequence.contains(retainedValue));
assertFalse(sequence.contains(toRemoveValue));
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistIndexOfConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistIndexOfConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.indexOf(sequence.get(2));
}
Aggregations