### Question:
ManifestCollector extends Collector { @Override public List<MetricFamilySamples> collect() { return mfs; } ManifestCollector(ManifestExtractor extractor, String manifestImplementationName); @Override List<MetricFamilySamples> collect();  }### Answer:
@Test public void testMetricOnPopulatedMap() { String key1 = "manifest-key-1"; String val1 = "manifest-value-1"; String key2 = "manifest-key-2"; String val2 = "manifest-value-2"; Map<String, String> manifest = ImmutableMap.of(key1, val1, key2, val2); Mockito.when(extractor.extractFromManifest(any())).thenReturn(manifest); ManifestCollector testee = new ManifestCollector(extractor, "apim-adapter"); List<Collector.MetricFamilySamples> collect = testee.collect(); Collector.MetricFamilySamples.Sample sample = collect.get(0).samples.get(0); assertThat(sample.labelNames, hasItem(key1.replaceAll("-","_"))); assertThat(sample.labelNames, hasItem(key2.replaceAll("-","_"))); assertThat(sample.labelValues, hasItem(val1)); assertThat(sample.labelValues, hasItem(val2)); }
@Test public void testMetricOnEmptyMap() { Map<String, String> manifest = Collections.emptyMap(); Mockito.when(extractor.extractFromManifest(any())).thenReturn(manifest); ManifestCollector testee = new ManifestCollector(extractor, "apim-adapter"); List<Collector.MetricFamilySamples> collect = testee.collect(); assertThat(collect.size(), is(0)); }