use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method removeAll.
@Test
public void removeAll() 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);
try {
history.removeAll(list);
fail();
} catch (UnsupportedOperationException e) {
// OK!
}
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method get.
@Test
public void get() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
TestKey testKey3 = new TestKey("Kappa");
History history = History.of(testKey1, testKey2, testKey3);
assertThat(history.get(0)).isSameAs(testKey1);
assertThat(history.get(1)).isSameAs(testKey2);
assertThat(history.get(2)).isSameAs(testKey3);
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method newBuilder.
@Test
public void newBuilder() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
assertThat(History.newBuilder().add(testKey1).add(testKey2).build()).containsExactly(testKey1, testKey2);
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class HistoryTest method from.
@Test
public void from() throws Exception {
TestKey testKey1 = new TestKey("Hello");
TestKey testKey2 = new TestKey("World");
assertThat(History.of(testKey1, testKey2)).containsExactly(testKey1, testKey2);
}
use of com.zhuinden.simplestack.helpers.TestKey in project simple-stack by Zhuinden.
the class BackstackTest method exitScopeExitsImplicitScopeCorrectly.
@Test
public void exitScopeExitsImplicitScopeCorrectly() {
Backstack backstack = new Backstack();
backstack.setScopedServices(new ServiceProvider());
Object firstKey = new TestKey("firstKey");
Object lastKey = new TestKey("lastKey");
Object key = new TestKeyWithScope("blah") {
@Override
public void bindServices(ServiceBinder serviceBinder) {
}
};
backstack.setup(History.of(firstKey, key, lastKey));
backstack.setStateChanger(new StateChanger() {
@Override
public void handleStateChange(@Nonnull StateChange stateChange, @Nonnull Callback completionCallback) {
completionCallback.stateChangeComplete();
}
});
backstack.exitScope("blah");
assertThat(backstack.getHistory()).containsExactly(firstKey);
}
Aggregations