PageableListModel implements IModel<T> { public void detach() { if(list instanceof IDetachable){ ((IDetachable) list).detach(); } } PageableListModel(int size); abstract T getPageList(int startIndex, int viewSize); void setObject(T object); T getObject(); void setStartIndex(int startIndex, int viewSize); int getStartIndex(); int getViewSize(); int getSize(); void detach(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testDetach() { TestModel model = new TestModel(); model.list = createMock(DetachableInterface.class); ((IDetachable)model.list).detach(); replayAll(); model.getObject(); model.detach(); verifyAll(); }