ItemsNavigationStrategy extends AbstractItemsNavigationStrategy { @Override public <T> Iterator<Item<T>> getItems( IItemFactory<T> factory, Iterator<IModel<T>> newModels, Iterator<Item<T>> existingItems) { return DefaultItemReuseStrategy.getInstance().getItems(factory,newModels, existingItems); }  @Override Iterator<Item<T>> getItems( IItemFactory<T> factory, Iterator<IModel<T>> newModels, Iterator<Item<T>> existingItems); @Override long getPageCreatedOnRender();  }
@Test(groups = {"wicketTests"} ) public void getItems_1(){ IQuickReuseStrategy strategy=new ItemsNavigationStrategy(); List<Integer>list=new ArrayList<Integer>(); list.add(45); list.add(76); IItemFactory factory=Mockito.mock(IItemFactory.class); final int index=0; final int index2=1; IModel<Integer>model1=new Model<Integer>(list.get(0)); IModel<Integer>model2=new Model<Integer>(list.get(1)); Item item1=new Item("0",0,model1) ; Mockito.when(factory.newItem(0,model1)).thenReturn(item1); Item item2=new Item("1",index2,model2); Mockito.when(factory.newItem(index2,model2)).thenReturn(item2); List<IModel<Integer>>newModels=new ArrayList<IModel<Integer>>(); newModels.add(model1); newModels.add(model2); Iterator<Item<Integer>>actual= strategy.getItems(factory,newModels.iterator(),null); Assert.assertEquals(actual.next(),item1); Assert.assertEquals(actual.next(),item2); }