ClosedCaptionManagerMarshmallow implements CaptionManager { @TargetApi(Build.VERSION_CODES.M) @Override public boolean isClosedCaptioningEnabled() { return captioningManager.isEnabled(); } ClosedCaptionManagerMarshmallow(CaptioningManager captioningManager); @TargetApi(Build.VERSION_CODES.M) static CaptionManager newInstance(Context context); @TargetApi(Build.VERSION_CODES.M) @Override boolean isClosedCaptioningEnabled();  }
@Test public void whenCheckingIfCloseCaptioningEnabled_thenCaptioningManagerIsCalled() { closedCaptionManager.isClosedCaptioningEnabled(); verify(mockCaptioningManager).isEnabled(); }
@Test public void whenSystemCaptioningManagerIsEnabled_thenClosedCaptioningIsEnabled() { when(mockCaptioningManager.isEnabled()).thenReturn(true); assertThat(closedCaptionManager.isClosedCaptioningEnabled()).isTrue(); }
@Test public void whenSystemCaptioningManagerIsDisabled_thenClosedCaptioningIsDisabled() { when(mockCaptioningManager.isEnabled()).thenReturn(false); assertThat(closedCaptionManager.isClosedCaptioningEnabled()).isFalse(); }