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