@Test
public void testBasic() throws Exception {

  // Create a keyset that contains a single HmacKey.
  KeyTemplate template = MacKeyTemplates.HMAC_SHA256_128BITTAG;
  KeysetManager manager = KeysetManager.withEmptyKeyset().rotate(template);
  Keyset keyset = manager.getKeysetHandle().getKeyset();
  try {
    KeysetHandle unused = NoSecretKeysetHandle.parseFrom(keyset.toByteArray());
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertExceptionContains(e, "keyset contains secret key material");
  }
}