### Question:
CollectionErasureMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { List<TypeDescription> typeDescriptions = new ArrayList<TypeDescription>(); for (TypeDefinition typeDefinition : target) { typeDescriptions.add(typeDefinition.asErasure()); } return matcher.matches(typeDescriptions); } CollectionErasureMatcher(ElementMatcher<? super Iterable<? extends TypeDescription>> matcher); boolean matches(T target); @Override String toString();  }### Answer:
@Test public void testMatch() throws Exception { when(matcher.matches(Arrays.asList(firstRaw, secondRaw))).thenReturn(true); assertThat(new CollectionErasureMatcher<Iterable<TypeDefinition>>(matcher).matches(Arrays.asList(first, second)), is(true)); verify(matcher).matches(Arrays.asList(firstRaw, secondRaw)); verifyNoMoreInteractions(matcher); verify(first).asErasure(); verifyNoMoreInteractions(first); verify(second).asErasure(); verifyNoMoreInteractions(second); }
@Test public void testNoMatch() throws Exception { assertThat(new CollectionErasureMatcher<Iterable<TypeDefinition>>(matcher).matches(Arrays.asList(first, second)), is(false)); verify(matcher).matches(Arrays.asList(firstRaw, secondRaw)); verifyNoMoreInteractions(matcher); verify(first).asErasure(); verifyNoMoreInteractions(first); verify(second).asErasure(); verifyNoMoreInteractions(second); }