### Question:
MoreLabel extends Label { @Override protected void onConfigure() { super.onConfigure(); setVisible(navigator.getRepeater().getCurrentPage() < navigator.getRepeater().getPageCount()-1) ; } MoreLabel(String id, IModel model, ItemsNavigatorBase navigator); ItemsNavigatorBase getNavigator(); @Override void renderHead(IHeaderResponse response);  }### Answer:
@Test(groups = {"wicketTests"}) public void onConfigure_1() { final String id = "id"; final long currentpage = 2,pages = 4; ItemsNavigatorBase navigator = Mockito.mock(ItemsNavigatorBase.class); IQuickView repeater = mock(IQuickView.class); Mockito.when(repeater.getCurrentPage()).thenReturn(currentpage); Mockito.when(repeater.getPageCount()).thenReturn(pages) ; Mockito.when(navigator.getRepeater()).thenReturn(repeater); IModel model=Mockito.mock(IModel.class); MoreLabel more = new MoreLabel(id,model, navigator); more.onConfigure(); Assert.assertTrue(more.isVisible()); }
@Test(groups = {"wicketTests"}) public void onConfigure_2() { final String id = "id"; final long currentpage = 3,pages = 4; ItemsNavigatorBase navigator = Mockito.mock(ItemsNavigatorBase.class); IQuickView repeater = mock(IQuickView.class); Mockito.when(repeater.getCurrentPage()).thenReturn(currentpage); Mockito.when(repeater.getPageCount()).thenReturn(pages) ; Mockito.when(navigator.getRepeater()).thenReturn(repeater); IModel model=Mockito.mock(IModel.class); MoreLabel more = new MoreLabel(id,model, navigator); more.onConfigure(); Assert.assertFalse(more.isVisible()); }
@Test(groups = {"wicketTests"}) public void onConfigure_3() { final String id = "id"; final long currentpage = 4,pages = 4; ItemsNavigatorBase navigator = Mockito.mock(ItemsNavigatorBase.class); IQuickView repeater = mock(IQuickView.class); Mockito.when(repeater.getCurrentPage()).thenReturn(currentpage); Mockito.when(repeater.getPageCount()).thenReturn(pages) ; Mockito.when(navigator.getRepeater()).thenReturn(repeater); IModel model=Mockito.mock(IModel.class); MoreLabel more = new MoreLabel(id,model, navigator); more.onConfigure(); Assert.assertFalse(more.isVisible()); }
@Test(groups = {"wicketTests"}) public void onConfigure_4() { final String id = "id"; final long currentpage = 5,pages = 4; ItemsNavigatorBase navigator = Mockito.mock(ItemsNavigatorBase.class); IQuickView repeater = mock(IQuickView.class); Mockito.when(repeater.getCurrentPage()).thenReturn(currentpage); Mockito.when(repeater.getPageCount()).thenReturn(pages) ; Mockito.when(navigator.getRepeater()).thenReturn(repeater); IModel model=Mockito.mock(IModel.class); MoreLabel more = new MoreLabel(id,model, navigator); more.onConfigure(); Assert.assertFalse(more.isVisible()); }