### Question:
RemoteConfigRepository extends AbstractConfigRepository { @Override protected synchronized void sync() { ApolloConfig previous = m_configCache.get(); ApolloConfig current = loadApolloConfig(); if (previous != current) { logger.debug("Remote Config refreshed!"); m_configCache.set(current); this.fireRepositoryChange(m_namespace, this.getConfig()); } if (current != null) { Tracer.logEvent(String.format("Apollo.Client.Configs.%s", current.getNamespaceName()), current.getReleaseKey()); } } RemoteConfigRepository(String namespace); @Override Properties getConfig(); @Override void setUpstreamRepository(ConfigRepository upstreamConfigRepository); @Override ConfigSourceType getSourceType(); void onLongPollNotified(ServiceDTO longPollNotifiedServiceDto, ApolloNotificationMessages remoteMessages);  }### Answer:
@Test public void testRepositoryChangeListener() throws Exception { Map<String, String> configurations = ImmutableMap.of("someKey", "someValue"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); RepositoryChangeListener someListener = mock(RepositoryChangeListener.class); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); remoteConfigRepository.addChangeListener(someListener); final ArgumentCaptor<Properties> captor = ArgumentCaptor.forClass(Properties.class); Map<String, String> newConfigurations = ImmutableMap.of("someKey", "anotherValue"); ApolloConfig newApolloConfig = assembleApolloConfig(newConfigurations); when(someResponse.getBody()).thenReturn(newApolloConfig); remoteConfigRepository.sync(); verify(someListener, times(1)).onRepositoryChange(eq(someNamespace), captor.capture()); assertEquals(newConfigurations, captor.getValue()); remoteConfigLongPollService.stopLongPollingRefresh(); }