MainViewModel extends ViewModel { public void onClickHiBrianLee() { try { attachedActivity.openUrl(appContext.getString(R.string.twitter_url)); } catch (URISyntaxException e) { e.printStackTrace(); } } MainViewModel(@NonNull ActivityComponent activityComponent,
                  @Nullable State savedInstanceState); void onClickButtonClicks(); void onClickButtonRecyclerView(); void onClickHiBrianLee();  }
@Test public void testOnClickHiBrianLee() throws Exception { when(appContext.getString(R.string.twitter_url)).thenReturn("test_url"); viewModel.onClickHiBrianLee(); verify(attachedActivity).openUrl("test_url"); }