@Test
public void test_wrapMultiple_works() throws Exception {

  PrimitiveSet<JwtMac> primitiveSet = PrimitiveSet.newPrimitiveSet(JwtMac.class);
  JwtMac mac1 = new JwtHmac("HS256", new SecretKeySpec(Random.randBytes(32), "HMAC"));
  primitiveSet.addPrimitive(
      mac1,
      Keyset.Key.newBuilder()
          .setKeyId(202020)
          .setStatus(KeyStatusType.ENABLED)
          .setOutputPrefixType(OutputPrefixType.RAW)
          .build());
  JwtMac mac2 = new JwtHmac("HS256", new SecretKeySpec(Random.randBytes(32), "HMAC"));
  PrimitiveSet.Entry<JwtMac> entry =
      primitiveSet.addPrimitive(
          mac2,
          Keyset.Key.newBuilder()
              .setKeyId(202021)
              .setStatus(KeyStatusType.ENABLED)
              .setOutputPrefixType(OutputPrefixType.RAW)
              .build());
  primitiveSet.setPrimary(entry);
  JwtMac wrapped = wrapper.wrap(primitiveSet);
  ToBeSignedJwt tbs = new ToBeSignedJwt.Builder().setJwtId("blah").build();
  String compact = wrapped.createCompact(tbs);
  JwtValidator validator = new JwtValidator.Builder().build();
  Jwt token = wrapped.verifyCompact(compact, validator);
  Jwt token2 = mac2.verifyCompact(compact, validator);
  assertThrows(GeneralSecurityException.class, () -> mac1.verifyCompact(compact, validator));
  assertThat(token.getJwtId()).isEqualTo("blah");
  assertThat(token.getAlgorithm()).isEqualTo("HS256");
  assertThat(token2.getJwtId()).isEqualTo("blah");
  assertThat(token2.getAlgorithm()).isEqualTo("HS256");
}