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