PrivateKeyStorage { public Set<String> names() { return this.keyStorage.names(); } PrivateKeyStorage(VirgilPrivateKeyExporter keyExporter, KeyStorage keyStorage); void delete(String keyName); boolean exists(String keyName); Tuple<VirgilPrivateKey, Map<String, String>> load(String keyName); Set<String> names(); void store(VirgilPrivateKey privateKey, String name, Map<String, String> meta);  }
@Test public void names() { when(this.keyStorage.names()).thenReturn(Sets.newSet("key1")); Set<String> names = storage.names(); assertNotNull(names); assertEquals(1, names.size()); assertEquals("key1", names.iterator().next()); }
@SuppressWarnings("unchecked") @Test public void names_empty() { when(this.keyStorage.names()).thenReturn(Collections.EMPTY_SET); Set<String> names = storage.names(); assertNotNull(names); assertTrue(names.isEmpty()); }