ItemNavigatorWithAdditionalItems implements ItemNavigator<T> { @Override public T getCurrentItem() { int n = baseNavigator.getNumOfItems(); return (currentPos < n) ? baseNavigator.navigateTo(currentPos) : additionalItems.isEmpty() ? null : additionalItems.get(currentPos - n); } 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 testGetCurrentItem() { assertEquals("foo", navigator.getCurrentItem()); }