@Test
public void testAes256CtrHmacSha256Template() throws Exception {

  KeyTemplate template = AesCtrHmacAeadKeyManager.aes256CtrHmacSha256Template();
  assertEquals(new AesCtrHmacAeadKeyManager().getKeyType(), template.getTypeUrl());
  assertEquals(KeyTemplate.OutputPrefixType.TINK, template.getOutputPrefixType());
  AesCtrHmacAeadKeyFormat format =
      AesCtrHmacAeadKeyFormat.parseFrom(
          template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
  assertTrue(format.hasAesCtrKeyFormat());
  assertTrue(format.getAesCtrKeyFormat().hasParams());
  assertEquals(32, format.getAesCtrKeyFormat().getKeySize());
  assertEquals(16, format.getAesCtrKeyFormat().getParams().getIvSize());
  assertTrue(format.hasHmacKeyFormat());
  assertTrue(format.getHmacKeyFormat().hasParams());
  assertEquals(32, format.getHmacKeyFormat().getKeySize());
  assertEquals(32, format.getHmacKeyFormat().getParams().getTagSize());
  assertEquals(HashType.SHA256, format.getHmacKeyFormat().getParams().getHash());
}