@Test public void shouldThrowAnIllegalArgumentExceptionIfTheSpecifiedImplementationDoesNotHaveANoArgsConstructor() throws Exception { CollectionBuilder<Integer> collectionBuilder = collectionBuilderWith(1, 2, 3); try { collectionBuilder.build(NoNoArgsConstructorStack.class); fail("Expected an IllegalArgumentException but got nothing."); } catch (IllegalArgumentException exception) { assertThat(exception.getMessage(), containsString( "Could not instantiate instance of type NoNoArgsConstructorStack. " + "Does it have a public no argument constructor?")); } }
@Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); } }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  static CollectionBuilder<E> collectionBuilder(); static CollectionBuilder<E> collectionBuilder(Class<E> elementClass); @Override Collection<E> build(); @Override Collection<E> build(Class<? extends Collection> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction); }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  static CollectionBuilder<E> collectionBuilder(); static CollectionBuilder<E> collectionBuilder(Class<E> elementClass); @Override Collection<E> build(); @Override Collection<E> build(Class<? extends Collection> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction);  }