@Test public void testKeyGeneration() throws Exception {

  char[] password = "CHANGE".toCharArray();
  Path destination = Paths.get(temporaryFolder.getRoot().getPath(), "derivation.jceks");
  int keySize = 128;
  String alias = "baseKey";
  GenerateAesKeyCommand.generate(password, destination, keySize, alias, new SecureRandom());
  assertThat(destination).exists();
  KeyStore keyStore = KeyStore.getInstance("JCEKS");
  try (InputStream in = Files.newInputStream(destination)) {
    keyStore.load(in, password);
  }
  assertThat(keyStore.isKeyEntry(alias)).isTrue();
  Key key = keyStore.getKey(alias, password);
  assertThat(key).isInstanceOf(SecretKey.class);
  SecretKey secretKey = (SecretKey) key;
  assertThat(secretKey.getEncoded()).hasSize(keySize/8);
}