SimpleChromeCustomTabsIntentBuilder { public CustomTabsIntent createIntent() { if (connection.isDisconnected()) { throw new IllegalStateException("An active connection to custom tabs service is required for intent creation"); } Session session = connection.getSession(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(session.getCustomTabsSession()); for (Composer composer : composers) { builder = composer.compose(builder); } return builder.build(); } SimpleChromeCustomTabsIntentBuilder(Connection connection, List<Composer> composers); static SimpleChromeCustomTabsIntentBuilder newInstance(Connection connection); SimpleChromeCustomTabsIntentBuilder withToolbarColor(@ColorInt int color); SimpleChromeCustomTabsIntentBuilder withUrlBarHiding(); SimpleChromeCustomTabsIntentBuilder withMenuItem(String label, PendingIntent pendingIntent); SimpleChromeCustomTabsIntentBuilder withDefaultShareMenuItem(); SimpleChromeCustomTabsIntentBuilder withActionButton(Bitmap icon, String description, PendingIntent pendingIntent, boolean shouldTint); SimpleChromeCustomTabsIntentBuilder withCloseButtonIcon(Bitmap icon); SimpleChromeCustomTabsIntentBuilder withExitAnimations(Context context, @AnimRes int enterResId, @AnimRes int exitResId); SimpleChromeCustomTabsIntentBuilder withStartAnimations(Context context, @AnimRes int enterResId, @AnimRes int exitResId); SimpleChromeCustomTabsIntentBuilder showingTitle(); CustomTabsIntent createIntent();  }
@Test(expected = IllegalStateException.class) public void givenThereIsNoConnection_whenCreatingIntent_thenDeveloperErrorIsThrown() { givenIsDisconnected(); simpleChromeCustomTabsIntentBuilder.createIntent(); }
@Test public void givenThereIsAConnection_whenCreatingIntent_thenSessionIsRetrieved() { givenIsConnected(); simpleChromeCustomTabsIntentBuilder.createIntent(); verify(mockConnection).getSession(); }
@Test public void givenThereIsAConnection_whenCreatingIntent_thenIntentIsCreated() { givenIsConnected(); CustomTabsIntent resultIntent = simpleChromeCustomTabsIntentBuilder.createIntent(); assertThat(resultIntent).isNotNull(); }