### Question:
ConsulMetaDataCollector implements MetaDataCollector { @Override public String getConsumerMetaData(MetadataIdentifier key) { return doGetMetaData(key); }  @Override URL getUrl(); @Override void setUrl(URL url); @Override void init(); @Override String getProviderMetaData(MetadataIdentifier key); @Override String getConsumerMetaData(MetadataIdentifier key);  }### Answer:
@Test public void testGetConsumerMetaData() { MetadataIdentifier identifier = buildIdentifier(false); Map<String, String> consumerParams = new HashMap<>(); consumerParams.put("k1", "v1"); consumerParams.put("k2", "1"); consumerParams.put("k3", "true"); String metadata = gson.toJson(consumerParams); consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), metadata); String consumerMetaData = consulMetaDataCollector.getConsumerMetaData(identifier); Map<String, String> retParams = gson.fromJson(consumerMetaData, new TypeToken<Map<String, String>>() { }.getType()); Assert.assertEquals(consumerParams, retParams); }
@Test public void testGetConsumerMetaData() { MetadataIdentifier identifier = buildIdentifier(false); Map<String, String> consumerParams = new HashMap<>(); consumerParams.put("k1", "v1"); consumerParams.put("k2", "1"); consumerParams.put("k3", "true"); String metadata = gson.toJson(consumerParams); consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), metadata); String consumerMetaData = consulMetaDataCollector.getConsumerMetaData(identifier); Map<String, String> retParams = gson.fromJson(consumerMetaData, new TypeToken<Map<String, String>>() { }.getType()); Assert.assertEquals(consumerParams, retParams); }