JsonFileKeyStorage implements KeyStorage { @Override public void delete(String keyName) { if (!exists(keyName)) { throw new KeyEntryNotFoundException(); } File file = new File(keysPath, keyName.toLowerCase()); file.delete(); } JsonFileKeyStorage();  JsonFileKeyStorage(String keysPath); @Override void delete(String keyName); @Override boolean exists(String keyName); @Override KeyEntry load(String keyName); @Override Set<String> names(); @Override void store(KeyEntry keyEntry); @Override KeyEntry createEntry(String name, byte[] value); @Override void update(KeyEntry keyEntry);  }
@Test public void delete() { storage.store(entry); storage.delete(alias); assertFalse(storage.exists(alias)); }
@Test public void delete_nonExisting() { assertThrows(KeyEntryNotFoundException.class, () -> { storage.delete(alias); }); }
@Test public void delete_nullName() { assertThrows(KeyEntryNotFoundException.class, () -> { storage.delete(null); }); }