@Test
public void testBuildPsshAtom() {

  byte[] schemeData = new byte[]{0, 1, 2, 3, 4, 5};
  byte[] psshAtom = PsshAtomUtil.buildPsshAtom(C.WIDEVINE_UUID, schemeData);
  // Read the PSSH atom back and assert its content is as expected.
  ParsableByteArray parsablePsshAtom = new ParsableByteArray(psshAtom);
  assertThat(parsablePsshAtom.readUnsignedIntToInt()).isEqualTo(psshAtom.length); // length
  assertThat(parsablePsshAtom.readInt()).isEqualTo(TYPE_pssh); // type
  int fullAtomInt = parsablePsshAtom.readInt(); // version + flags
  assertThat(parseFullAtomVersion(fullAtomInt)).isEqualTo(0);
  assertThat(parseFullAtomFlags(fullAtomInt)).isEqualTo(0);
  UUID systemId = new UUID(parsablePsshAtom.readLong(), parsablePsshAtom.readLong());
  assertThat(systemId).isEqualTo(WIDEVINE_UUID);
  assertThat(parsablePsshAtom.readUnsignedIntToInt()).isEqualTo(schemeData.length);
  byte[] psshSchemeData = new byte[schemeData.length];
  parsablePsshAtom.readBytes(psshSchemeData, 0, schemeData.length);
  assertThat(psshSchemeData).isEqualTo(schemeData);
}