@Test
public void newKey_MessageLite_throwsWrongProto() throws Exception {

  KeyManager<Aead> keyManager = new KeyManagerImpl<>(new TestKeyTypeManager(), Aead.class);
  try {
    // Note: newKey expects AesGcmKeyFormat, not AesGcmKey.
    keyManager.newKey(AesGcmKey.getDefaultInstance());
    fail("expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("Expected proto of type");
  }
}