@Test
public void testLoadSecretKey() throws Exception {

    // given
    SecretKey secretKey = Encryption.generateNewKey();
    File confDir = Files.createTempDir();
    File secretKeyFile = new File(confDir, "secret");
    byte[] encodedKey = secretKey.getEncoded();
    Files.write(encodedKey, secretKeyFile);
    // when
    LazySecretKey lazySecretKey = new LazySecretKeyImpl(Arrays.asList(confDir));
    // then
    assertThat(lazySecretKey.getOrCreate().getEncoded()).isEqualTo(encodedKey);
    // cleanup
    secretKeyFile.delete();
    confDir.delete();
}