### Question:
VavrCollectorFactory implements CollectorFactory { @Override public boolean accepts(Type containerType) { Class<?> erasedType = getCollectionType(containerType); final boolean hasCollector = collectors.containsKey(erasedType); return (hasCollector || hasDefaultImplementationWithCollector(erasedType)) && containerType instanceof ParameterizedType; }  @Override boolean accepts(Type containerType); @Override Optional<Type> elementType(Type containerType); @Override Collector<?, ?, ?> build(Type containerType);  }### Answer:
@Test public void testAcceptCollectionImplementationTypesShouldSucceed() { assertThat(unit.accepts(new GenericType<Array<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Vector<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<List<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Stream<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Queue<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<PriorityQueue<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<HashSet<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<LinkedHashSet<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<TreeSet<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<HashMap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<LinkedHashMap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<TreeMap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<HashMultimap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<LinkedHashMultimap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<TreeMultimap<?, ?>>() {}.getType())).isTrue(); }
@Test public void testAcceptNonVavrCollectionShouldFail() { assertThat(unit.accepts(new GenericType<java.util.List<?>>() {}.getType())).isFalse(); assertThat(unit.accepts(new GenericType<java.util.Map<?, ?>>() {}.getType())).isFalse(); }
@Test public void testAcceptCollectionSuperTypesShouldSucceed() { assertThat(unit.accepts(new GenericType<Traversable<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Seq<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<IndexedSeq<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<LinearSeq<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Set<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<SortedSet<?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Map<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<SortedMap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<Multimap<?, ?>>() {}.getType())).isTrue(); assertThat(unit.accepts(new GenericType<SortedMultimap<?, ?>>() {}.getType())).isTrue(); }