use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method retainAll.
@Test
public void retainAll() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
TestKey testKey3 = new TestKey("Kappa");
List<Object> list = new ArrayList<>();
list.add(testKey3);
History history = History.of(testKey1, testKey2, testKey3);
try {
history.retainAll(list);
fail();
} catch (UnsupportedOperationException e) {
// OK!
}
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method addWithIndex.
@Test
public void addWithIndex() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
History history = History.of(testKey1);
try {
history.add(0, testKey2);
fail();
} catch (UnsupportedOperationException e) {
// OK!
}
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method isEmpty.
@Test
public void isEmpty() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
TestKey testKey3 = new TestKey("Kappa");
History history1 = History.of(testKey1, testKey2, testKey3);
assertThat(history1.isEmpty()).isFalse();
assertThat(History.of().isEmpty()).isTrue();
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method listIterator.
@Test
public void listIterator() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
TestKey testKey3 = new TestKey("Kappa");
History history = History.of(testKey1, testKey2, testKey3);
Iterator<Object> keys = history.listIterator();
while (keys.hasNext()) {
Object key = keys.next();
assertThat(key).isIn(testKey1, testKey2, testKey3);
}
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method lastIndexOf.
@Test
public void lastIndexOf() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
History history = History.of(testKey1, testKey2);
assertThat(history.lastIndexOf(testKey2)).isEqualTo(1);
assertThat(history.lastIndexOf(testKey1)).isEqualTo(0);
}
Aggregations