use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method subListToIndexExceedsSize.
@Test(expected = IndexOutOfBoundsException.class)
public void subListToIndexExceedsSize() {
IonSequence seq = newSequence();
// toIndex is exclusive, hence the + 1
seq.subList(0, seq.size() + 1);
}
use of com.amazon.ion.IonSequence 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.IonSequence 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.IonSequence 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);
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistLastIndexOf.
@Test
public void sublistLastIndexOf() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
assertEquals(0, sublist.lastIndexOf(sequence.get(2)));
assertEquals(-1, sublist.lastIndexOf(sequence.get(0)));
assertEquals(-1, sublist.lastIndexOf(SYSTEM.newInt(99)));
}
Aggregations