### Question:
ComposerFormatAttributesExtractor extends ComponentSupport { @VisibleForTesting void extractAuthors(final Map<String, Object> contents, final NestedAttributesMap formatAttributes) { Object sourceValue = contents.get(AUTHORS); if (sourceValue instanceof Collection) { List<String> authors = new ArrayList<>(); for (Object author : (Collection) sourceValue) { if (author instanceof Map) { List<String> parts = new ArrayList<>(); extractAuthorPart((Map<String, Object>) author, parts, AUTHOR_NAME, "%s"); extractAuthorPart((Map<String, Object>) author, parts, AUTHOR_EMAIL, "<%s>"); extractAuthorPart((Map<String, Object>) author, parts, AUTHOR_HOMEPAGE, "(%s)"); if (!parts.isEmpty()) { authors.add(String.join(" ", parts)); } } } if (!authors.isEmpty()) { formatAttributes.set(P_AUTHORS, authors); } } } @Inject  ComposerFormatAttributesExtractor(final ComposerJsonExtractor composerJsonExtractor); void extractFromZip(final TempBlob tempBlob, final NestedAttributesMap formatAttributes);  }### Answer:
@Test public void extractAuthorsMissing() { underTest.extractAuthors(emptyMap(), destination); assertThat(destination.keys(), is(empty())); }
@Test public void extractAuthorsNull() { underTest.extractAuthors(singletonMap("authors", null), destination); assertThat(destination.keys(), is(empty())); }
@Test public void extractAuthorsEmptyCollection() { underTest.extractAuthors(singletonMap("authors", emptyList()), destination); assertThat(destination.keys(), is(empty())); }
@Test public void extractAuthorsEmptyAuthor() { underTest.extractAuthors(singletonMap("authors", singletonList(emptyMap())), destination); assertThat(destination.keys(), is(empty())); }
@Test public void extractAuthorsAuthorName() { underTest.extractAuthors(singletonMap("authors", singletonList(singletonMap("name", "value"))), destination); assertThat(destination.keys(), contains(P_AUTHORS)); assertThat((List<String>) destination.get(P_AUTHORS), contains("value")); }
@Test public void extractAuthorsAuthorEmail() { underTest.extractAuthors(singletonMap("authors", singletonList(singletonMap("email", "value"))), destination); assertThat(destination.keys(), contains(P_AUTHORS)); assertThat((List<String>) destination.get(P_AUTHORS), contains("<value>")); }
@Test public void extractAuthorsAuthorHomepage() { underTest.extractAuthors(singletonMap("authors", singletonList(singletonMap("homepage", "value"))), destination); assertThat(destination.keys(), contains(P_AUTHORS)); assertThat((List<String>) destination.get(P_AUTHORS), contains("(value)")); }