### Question:
LocalFileRegistry extends InMemoryRegistry { @Override public Map<String, Object> getMap() { if (null == map) { synchronized (mutex) { if (null == map) { final Map<String, Object> registryMap = new ConcurrentHashMap<>(); if (registryFile.exists()) { try (final InputStream in = FileUtils.openInputStream(registryFile)) { final RegistryWrapper wrapper = mapper.readValue(in, RegistryWrapper.class); registryMap.putAll(wrapper.getApis().stream() .collect(toMap(this::getApiIndex, identity()))); registryMap.putAll(wrapper.getClients().stream() .collect(toMap(this::getClientIndex, identity()))); } catch (Exception e) { throw new RuntimeException("Error reading registry from file: " + registryFile, e); } } else { System.err.println("Local registry file does not exists under path " + registryFile.getAbsolutePath()); } map = registryMap; } } } return map; } LocalFileRegistry(Map<String, String> config); @Override Map<String, Object> getMap(); @Override void publishApi(Api api, IAsyncResultHandler<Void> handler); @Override void retireApi(Api api, IAsyncResultHandler<Void> handler); @Override void registerClient(Client client, IAsyncResultHandler<Void> handler); @Override void unregisterClient(Client client, IAsyncResultHandler<Void> handler);  }### Answer:
@Test public void readExistingRegistry() { final Map<String, String> config = new HashMap<String, String>() {{ try { put(CONFIG_REGISTRY_PATH, LocalFileRegistryTest.class.getResource("/populated-registry.json").toURI().getPath()); } catch (URISyntaxException e) { System.err.println("Cannot access populated-registry.json resource"); e.printStackTrace(); } }}; final LocalFileRegistry registry = new LocalFileRegistry(config); assertFalse("The map should not be empty", registry.getMap().isEmpty()); assertNotNull("The API should exist in the map", registry.getMap().get("API::org|apiB|1.0")); registry.getApi("org", "apiB", "1.0", result -> { assertTrue(result.isSuccess()); assertNotNull(result.getResult()); assertEquals("apiB", result.getResult().getApiId()); }); }