### Question:
FileSecureStoreService extends AbstractIdleService implements SecureStoreService { @Override public SecureStoreData get(String namespace, String name) throws Exception { checkNamespaceExists(namespace); String keyName = getKeyName(namespace, name); readLock.lock(); try { if (!keyStore.containsAlias(keyName)) { throw new NotFoundException(name + " not found in the secure store."); } Key key = keyStore.getKey(keyName, password); return deserialize(key.getEncoded()); } catch (NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException e) { throw new IOException("Unable to retrieve the key " + name, e); } finally { readLock.unlock(); } } @Inject  FileSecureStoreService(CConfiguration cConf, SConfiguration sConf, NamespaceQueryAdmin namespaceQueryAdmin); @Override void put(String namespace, String name, String data, @Nullable String description,
                  Map<String, String> properties); @Override void delete(String namespace, String name); @Override List<SecureStoreMetadata> list(String namespace); @Override SecureStoreData get(String namespace, String name);  }### Answer:
@Test public void testGet() throws Exception { populateStore(); SecureStoreMetadata metadata = new SecureStoreMetadata(KEY1, DESCRIPTION1, System.currentTimeMillis(), PROPERTIES_1); SecureStoreData secureStoreData = new SecureStoreData(metadata, VALUE1.getBytes(Charsets.UTF_8)); Assert.assertArrayEquals(secureStoreData.get(), secureStore.get(NAMESPACE1, KEY1).get()); Assert.assertEquals(metadata.getDescription(), secureStore.get(NAMESPACE1, KEY1).getMetadata().getDescription()); Assert.assertEquals(metadata.getName(), secureStore.get(NAMESPACE1, KEY1).getMetadata().getName()); }
@Test public void testGetMetadata() throws Exception { populateStore(); SecureStoreMetadata metadata = new SecureStoreMetadata(KEY1, DESCRIPTION1, System.currentTimeMillis(), PROPERTIES_1); Assert.assertEquals(metadata.getDescription(), secureStore.get(NAMESPACE1, KEY1).getMetadata().getDescription()); Assert.assertEquals(metadata.getName(), secureStore.get(NAMESPACE1, KEY1).getMetadata().getName()); SecureStoreMetadata metadata2 = new SecureStoreMetadata(KEY2, DESCRIPTION2, System.currentTimeMillis(), PROPERTIES_2); Assert.assertEquals(metadata2.getDescription(), secureStore.get(NAMESPACE1, KEY2).getMetadata().getDescription()); Assert.assertEquals(metadata2.getName(), secureStore.get(NAMESPACE1, KEY2).getMetadata().getName()); }
@Test(expected = NotFoundException.class) public void testGetNonExistent() throws Exception { secureStore.get(NAMESPACE1, "Dummy"); }