NoteListViewModel extends ViewModel<Void, NoteListModel> { public void openDetail(String objectId) { navigator.openDetail(activityHolder, objectId); } NoteListViewModel(NoteLoader service, Executor backgroundExecutor, Executor uiExecutor, Navigator navigator); @NonNull @Override NoteListModel createModel(); @Override void resume(); void reloadData(); ObservableBoolean getLoading(); void openDetail(String objectId); void openCreateNewNote(); void onResult(int requestCode, ActivityResult activityResult); @Override int getOptionMenuId(); @Override boolean onOptionsItemSelected(int itemId);  }
@Test public void testOpenDetail() { when(service.loadItems()).thenReturn(TestData.response()); viewModel.initAndResume(); viewModel.openDetail(TestData.ID_1); verify(navigator).openDetail(any(ActivityHolder.class), captor.capture()); assertThat(captor.getValue()).isEqualTo(TestData.ID_1); }