SearchContextModel implements IModel<SearchContext>, SearchContext { @Override public void detach() { selectionModel.detach(); } SearchContextModel(IModel<QueryFacetsSelection> selectionModel);  SearchContextModel(Long index, Long resultCount, IModel<QueryFacetsSelection> selectionModel); IModel<QueryFacetsSelection> getSelectionModel(); @Override QueryFacetsSelection getSelection(); @Override Long getResultCount(); @Override Long getIndex(); @Override SearchContext getObject(); @Override void detach(); static SearchContextModel next(SearchContext current); static SearchContextModel previous(SearchContext current); @Override boolean hasPrevious(); @Override boolean hasNext();  }
@Test public void testDetach() { final IModel selectionModel = context.mock(IModel.class); instance = new SearchContextModel(index, resultCount, selectionModel); context.checking(new Expectations() { { oneOf(selectionModel).detach(); } }); instance.detach(); }