@Test
public void testCopy() throws Exception {

  Format[][] formats = newFormats(2, 3);
  SsManifest sourceManifest =
      createSsManifest(
          createStreamElement("1", formats[0]), createStreamElement("2", formats[1]));
  List<StreamKey> keys =
      Arrays.asList(new StreamKey(0, 0), new StreamKey(0, 2), new StreamKey(1, 0));
  // Keys don't need to be in any particular order
  Collections.shuffle(keys, new Random(0));
  SsManifest copyManifest = sourceManifest.copy(keys);
  SsManifest expectedManifest =
      createSsManifest(
          createStreamElement("1", formats[0][0], formats[0][2]),
          createStreamElement("2", formats[1][0]));
  assertManifestEquals(expectedManifest, copyManifest);
}