### Question:
AbstractRegistry implements Registry { protected void recover() throws Exception { Set<URL> recoverRegistered = new HashSet<URL>(getRegistered()); if (!recoverRegistered.isEmpty()) { if (logger.isInfoEnabled()) { logger.info("Recover register url " + recoverRegistered); } for (URL url : recoverRegistered) { register(url); } } Map<URL, Set<NotifyListener>> recoverSubscribed = new HashMap<URL, Set<NotifyListener>>(getSubscribed()); if (!recoverSubscribed.isEmpty()) { if (logger.isInfoEnabled()) { logger.info("Recover subscribe url " + recoverSubscribed.keySet()); } for (Map.Entry<URL, Set<NotifyListener>> entry : recoverSubscribed.entrySet()) { URL url = entry.getKey(); for (NotifyListener listener : entry.getValue()) { subscribe(url, listener); } } } } AbstractRegistry(URL url); @Override URL getUrl(); Set<URL> getRegistered(); Map<URL, Set<NotifyListener>> getSubscribed(); Map<URL, Map<String, List<URL>>> getNotified(); File getCacheFile(); Properties getCacheProperties(); AtomicLong getLastCacheChanged(); void doSaveProperties(long version); List<URL> getCacheUrls(URL url); @Override List<URL> lookup(URL url); @Override void register(URL url); @Override void unregister(URL url); @Override void subscribe(URL url, NotifyListener listener); @Override void unsubscribe(URL url, NotifyListener listener); @Override void destroy(); @Override String toString();  }### Answer:
@Test public void testRecover() throws Exception { abstractRegistry.recover(); Assertions.assertFalse(abstractRegistry.getRegistered().contains(testUrl)); Assertions.assertNull(abstractRegistry.getSubscribed().get(testUrl)); abstractRegistry.register(testUrl); abstractRegistry.subscribe(testUrl, listener); abstractRegistry.recover(); Assertions.assertTrue(abstractRegistry.getRegistered().contains(testUrl)); Assertions.assertNotNull(abstractRegistry.getSubscribed().get(testUrl)); Assertions.assertTrue(abstractRegistry.getSubscribed().get(testUrl).contains(listener)); }