@Test
public void testSelectTracksPreferTrackWithinCapabilities() throws Exception {

  Format supportedFormat = buildAudioFormat("supportedFormat");
  Format exceededFormat = buildAudioFormat("exceededFormat");
  TrackGroupArray trackGroups = wrapFormats(exceededFormat, supportedFormat);
  Map<String, Integer> mappedCapabilities = new HashMap<>();
  mappedCapabilities.put(supportedFormat.id, FORMAT_HANDLED);
  mappedCapabilities.put(exceededFormat.id, FORMAT_EXCEEDS_CAPABILITIES);
  RendererCapabilities mappedAudioRendererCapabilities =
      new FakeMappedRendererCapabilities(C.TRACK_TYPE_AUDIO, mappedCapabilities);
  TrackSelectorResult result =
      trackSelector.selectTracks(
          new RendererCapabilities[] {mappedAudioRendererCapabilities},
          trackGroups,
          periodId,
          TIMELINE);
  assertFixedSelection(result.selections.get(0), trackGroups, supportedFormat);
}