use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistAdd.
@Test
public void sublistAdd() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final IonInt value = SYSTEM.newInt(99);
sublist.add(value);
assertEquals(4, sublist.size());
assertEquals(value, sublist.get(3));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistRetainAllConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistRetainAllConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.retainAll(Arrays.asList(SYSTEM.newInt(100), SYSTEM.newInt(101)));
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistAddWithIndex.
@Test
public void sublistAddWithIndex() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final IonInt value = SYSTEM.newInt(99);
sublist.add(0, value);
assertEquals(4, sublist.size());
assertEquals(value, sublist.get(0));
assertEquals(2, ((IonInt) sublist.get(1)).intValue());
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistGet.
@Test
public void sublistGet() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final IonValue element = sublist.get(0);
assertEquals(2, ((IonInt) element).intValue());
}
use of com.amazon.ion.IonValue in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistAddAll.
@Test
public void sublistAddAll() {
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(values);
assertEquals(5, sublist.size());
assertEquals(values.get(0), sublist.get(3));
assertEquals(values.get(1), sublist.get(4));
}
Aggregations