ItemNavigatorWithAdditionalItems implements ItemNavigator<T> { @Override public T navigateTo(int itemPos) { currentPos = itemPos; if (currentPos < baseNavigator.getNumOfItems()) { baseNavigator.navigateTo(itemPos); } return getCurrentItem(); } ItemNavigatorWithAdditionalItems(ItemNavigator<T> baseNavigator, T... transientItems); @Override T navigateTo(int itemPos); @Override T getCurrentItem(); @Override int getNumOfItems(); @Override int getCurrentItemIdx(); @Override void clearCaches(); ItemNavigator<T> getBaseNavigator(); List<T> getAdditionalItems(); int addAdditionalItem(T item);  }
@Test public void testNavigateTo() { assertEquals("baz", navigator.navigateTo(2)); assertEquals("foo", navigator.navigateTo(0)); assertEquals("bar", navigator.navigateTo(1)); }