@Test
public void getPrimitive_MessageLite_throwsWrongProto() throws Exception {

  KeyManager<Aead> keyManager = new KeyManagerImpl<>(new TestKeyTypeManager(), Aead.class);
  MessageLite notAKey = AesGcmKeyFormat.getDefaultInstance();
  try {
    keyManager.getPrimitive(notAKey);
    fail("expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("Expected proto of type");
  }
}