DefaultQuickReuseStrategy extends AbstractPagingNavigationStrategy { @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);  }
@Test(groups = {"wicketTests"} ) public void getItems_1(){ IQuickReuseStrategy strategy=new DefaultQuickReuseStrategy(); List<Integer> list=new ArrayList<Integer>(); list.add(45); list.add(76); List<Item<Integer>>existingItems=new ArrayList<Item<Integer>>(); 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(),existingItems.iterator()); Assert.assertEquals(actual.next(), item1); Assert.assertEquals(actual.next(),item2); Mockito.verify(factory,Mockito.times(1)).newItem(index,model1); Mockito.verify(factory,Mockito.times(1)).newItem(index2,model2); }