@Test
public void aaaTestInitialization() throws Exception {

  try {
    Registry.getCatalogue("tinkmac");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("MacConfig.register()");
  }
  try {
    Registry.getCatalogue("tinkaead");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("AeadConfig.register()");
  }
  try {
    Registry.getCatalogue("tinkhybriddecrypt");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("HybridConfig.register()");
  }
  try {
    Registry.getCatalogue("tinkhybridencrypt");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("HybridConfig.register()");
  }
  try {
    Registry.getCatalogue("tinkpublickeysign");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("SignatureConfig.register()");
  }
  try {
    Registry.getCatalogue("tinkpublickeyverify");
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("no catalogue found");
    assertThat(e.toString()).contains("SignatureConfig.register()");
  }
  String macTypeUrl = "type.googleapis.com/google.crypto.tink.HmacKey";
  String aeadTypeUrl = "type.googleapis.com/google.crypto.tink.AesCtrHmacAeadKey";
  String daeadTypeUrl = "type.googleapis.com/google.crypto.tink.AesSivKey";
  String hybridTypeUrl = "type.googleapis.com/google.crypto.tink.EciesAeadHkdfPrivateKey";
  String signTypeUrl = "type.googleapis.com/google.crypto.tink.EcdsaPrivateKey";
  String streamingAeadTypeUrl = "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey";
  try {
    Registry.getUntypedKeyManager(macTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  try {
    Registry.getUntypedKeyManager(aeadTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  try {
    Registry.getUntypedKeyManager(daeadTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  try {
    Registry.getUntypedKeyManager(hybridTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  try {
    Registry.getUntypedKeyManager(signTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  try {
    Registry.getUntypedKeyManager(streamingAeadTypeUrl);
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertThat(e.toString()).contains("No key manager found");
  }
  // Initialize the config.
  TinkConfig.register();
  // After registration the key managers should be present.
  Config.register(TinkConfig.TINK_1_1_0);
  Registry.getUntypedKeyManager(macTypeUrl);
  Registry.getUntypedKeyManager(aeadTypeUrl);
  Registry.getUntypedKeyManager(daeadTypeUrl);
  Registry.getUntypedKeyManager(hybridTypeUrl);
  Registry.getUntypedKeyManager(signTypeUrl);
  Registry.getUntypedKeyManager(streamingAeadTypeUrl);
}