DefaultKeyStorage implements KeyStorage { @Override public Set<String> names() { Entries entries = load(); return entries.keySet(); } DefaultKeyStorage();  DefaultKeyStorage(String directoryName, String fileName); @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 names() { storage.store(entry); Set<String> names = storage.names(); assertNotNull(names); assertEquals(1, names.size()); assertEquals(entry.getName(), names.iterator().next()); }
@Test public void names_empty() { Set<String> names = storage.names(); assertNotNull(names); assertTrue(names.isEmpty()); }