@Test
  public void getListOfKeys() throws Exception {
    // We need a fresh instance of the store for this test.
    CredentialStorage credStore1 =
        new PersistentCredentialStorage(TemporaryFileFactory.createTemporaryFile());
    CredentialManagerImpl credMng1 = new CredentialManagerImpl(credStore1);
    Map<URI, SecretKey> keys = new HashMap<URI, SecretKey>();
    for (int i = 0; i != 10; ++i) {
      SecretKey inspectorSecretKey = new SecretKey();
      CryptoParams cryptoParams = new CryptoParams();
      cryptoParams.getContent().add("TestString1");
      inspectorSecretKey.setCryptoParams(cryptoParams);
      keys.put(URI.create(UUID.randomUUID().toString()), inspectorSecretKey);
    }

    for (Map.Entry<URI, SecretKey> k : keys.entrySet()) {
      credMng1.storeInspectorSecretKey(k.getKey(), k.getValue());
    }

    Object[] keysInStore = credMng1.listInspectorSecretKeys().toArray();
    Object[] keysCreated = keys.keySet().toArray();
    // We need to ensure same order.
    Arrays.sort(keysInStore);
    Arrays.sort(keysCreated);
    assertArrayEquals(keysInStore, keysCreated);
  }
  @Test
  public void storeKey() throws Exception {
    SecretKey inspectorSecretKey = new SecretKey();
    CryptoParams cryptoParams = new CryptoParams();
    cryptoParams.getContent().add("TestString1");
    inspectorSecretKey.setCryptoParams(cryptoParams);
    credMng.storeInspectorSecretKey(EXPECTED_UUID, inspectorSecretKey);

    SecretKey storedInspectorSecretKey = credMng.getInspectorSecretKey(EXPECTED_UUID);
    assertEquals(
        inspectorSecretKey.getCryptoParams().getContent().get(0),
        storedInspectorSecretKey.getCryptoParams().getContent().get(0));
  }