@Test
public void testSelectTracksPreferHigherSampleRateBeforeBitrate()
    throws Exception {

  Format higherSampleRateLowerBitrateFormat =
      Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000,
          Format.NO_VALUE, 2, 44100, null, null, 0, null);
  Format lowerSampleRateHigherBitrateFormat =
      Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 30000,
          Format.NO_VALUE, 2, 22050, null, null, 0, null);
  TrackGroupArray trackGroups =
      wrapFormats(higherSampleRateLowerBitrateFormat, lowerSampleRateHigherBitrateFormat);
  TrackSelectorResult result =
      trackSelector.selectTracks(
          new RendererCapabilities[] {ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES},
          trackGroups,
          periodId,
          TIMELINE);
  assertFixedSelection(result.selections.get(0), trackGroups, higherSampleRateLowerBitrateFormat);
}