use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistSublist.
@Test
public void sublistSublist() {
IonSequence sequence = newSequence();
// 1,2,3,4
final List<IonValue> sublist = sequence.subList(1, 5);
// 2
final List<IonValue> subSublist = sublist.subList(1, 2);
assertEquals(sublist.get(1), subSublist.get(0));
assertEquals(sequence.get(2), subSublist.get(0));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistIteratorConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistIteratorConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.add(SYSTEM.newInt(99));
sublist.iterator();
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistContains.
@Test
public void sublistContains() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final IonValue insideSubList = sequence.get(2);
final IonValue outsideSublist = sequence.get(0);
assertTrue(sublist.contains(insideSubList));
assertFalse(sublist.contains(outsideSublist));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistAddAllWithIndex.
@Test
public void sublistAddAllWithIndex() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final List<IonInt> values = Arrays.asList(SYSTEM.newInt(100), SYSTEM.newInt(101));
sublist.addAll(0, values);
assertEquals(5, sublist.size());
assertEquals(values.get(0), sublist.get(0));
assertEquals(values.get(1), sublist.get(1));
assertEquals(2, ((IonInt) sublist.get(2)).intValue());
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistGetConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistGetConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.clear();
sublist.get(0);
}
Aggregations