@Test
public void testAddListener() throws NacosException {

	final Listener listener = new AbstractListener() {
		@Override
		public void receiveConfigInfo(String configInfo) {
			Assert.assertEquals(CONTENT, configInfo);
		}
	};
	// assert NacosConfigReceivedEvent
	context.addApplicationListener(
			new ApplicationListener<NacosConfigReceivedEvent>() {
				@Override
				public void onApplicationEvent(NacosConfigReceivedEvent event) {
					assertNacosConfigEvent(event);
					Assert.assertEquals(CONTENT, event.getContent());
				}
			});
	// assert NacosConfigListenerRegisteredEvent
	context.addApplicationListener(
			new ApplicationListener<NacosConfigListenerRegisteredEvent>() {
				@Override
				public void onApplicationEvent(
						NacosConfigListenerRegisteredEvent event) {
					assertNacosConfigEvent(event);
					Assert.assertTrue(event.isRegistered());
					Assert.assertEquals(listener, event.getListener());
				}
			});
	// Add Listener
	configService.addListener(DATA_ID, GROUP_ID, listener);
	// Publish Config
	configService.publishConfig(DATA_ID, GROUP_ID, CONTENT);
}