### Question:
ComposerFormatAttributesExtractor extends ComponentSupport { @VisibleForTesting void extractStrings(final Map<String, Object> source, final NestedAttributesMap destination, final Map<String, String> mappings) { for (Map.Entry<String, String> mapping : mappings.entrySet()) { Object sourceValue = source.get(mapping.getKey()); if (sourceValue instanceof String) { destination.set(mapping.getValue(), sourceValue); } else if (sourceValue instanceof Collection) { List<String> entries = new ArrayList<>(); for (Object entryValue : (Collection) sourceValue) { if (entryValue instanceof String) { entries.add((String) entryValue); } } if (!entries.isEmpty()) { destination.set(mapping.getValue(), entries); } } } } @Inject  ComposerFormatAttributesExtractor(final ComposerJsonExtractor composerJsonExtractor); void extractFromZip(final TempBlob tempBlob, final NestedAttributesMap formatAttributes);  }### Answer:
@Test public void extractStringsMissing() { underTest.extractStrings(emptyMap(), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), is(empty())); }
@Test public void extractStringsNull() { underTest.extractStrings(singletonMap("inkey", null), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), is(empty())); }
@Test public void extractStringsNonStringValue() { underTest.extractStrings(singletonMap("inkey", Integer.MAX_VALUE), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), is(empty())); }
@Test public void extractStringsSingleString() { underTest.extractStrings(singletonMap("inkey", "value"), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), contains("outkey")); assertThat(destination.get("outkey"), is("value")); }
@Test public void extractStringsEmptyCollection() { underTest.extractStrings(singletonMap("inkey", emptyList()), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), is(empty())); }
@Test public void extractStringsCollectionWithNonStringValue() { underTest.extractStrings(singletonMap("inkey", Integer.MAX_VALUE), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), is(empty())); }
@Test public void extractStringsCollectionWithString() { underTest .extractStrings(singletonMap("inkey", singletonList("value")), destination, singletonMap("inkey", "outkey")); assertThat(destination.keys(), contains("outkey")); assertThat((List<String>) destination.get("outkey"), contains("value")); }