AddViewModel extends WatchLaterViewModel implements AccountRepository.TokenCallback, YoutubeRepository.AddVideoCallback,
        YoutubeRepository.VideoInfoCallback { @Override public void onToken(boolean hasError, String token, Intent intent) { if (hasError && intent != null) { videoAdd.setValue(VideoAdd.INTENT(intent)); return; } if (hasError) { videoAdd.setValue(VideoAdd.ERROR(VideoAdd.ErrorType.NO_ACCOUNT)); return; } if (videoId == null) { throw new IllegalStateException("cannot query video without id"); } youtubeRepository.addVideo(videoId, token, this); } @SuppressWarnings("WeakerAccess")  AddViewModel(WatchLaterApplication application); LiveData<Account> getAccount(); void setAccount(Account account); void setVideoUri(Uri uri); LiveData<VideoInfo> getVideoInfo(); LiveData<VideoAdd> getVideoAdd(); LiveData<Boolean> getPermissionNeeded(); void setPermissionNeeded(boolean needsPermission); void watchLater(); @Override void onToken(boolean hasError, String token, Intent intent); @Override void onAddResult(YoutubeRepository.ErrorType errorType, String token); @Override void onVideoInfoResult(YoutubeRepository.ErrorType errorType, YoutubeRepository.Videos.Item item);  }
@Test(expected = IllegalStateException.class) public void should_throw_when_token_but_no_videoid() { viewModel.onToken(false, "test", null); }