@Test public void shouldThrowAnIllegalArgumentExceptionIfTheSpecifiedImplementationDoesNotHaveAnAccessibleConstructor() throws Exception { MultisetBuilder<Integer> multisetBuilder = multisetBuilderWith(1, 2, 3); try { multisetBuilder.build(PrivateAccessConstructorMultiset.class); fail("Expected an IllegalArgumentException but got nothing."); } catch (IllegalArgumentException exception) { assertThat(exception.getMessage(), containsString( "Could not instantiate instance of type PrivateAccessConstructorMultiset. " + "Does it have a public no argument constructor?")); } }
@Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); } }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  static MultisetBuilder<E> multisetBuilder(); static MultisetBuilder<E> multisetBuilder(Class<E> elementClass); @Override Multiset<E> build(); @Override Multiset<E> build(Class<? extends Multiset> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction); }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  static MultisetBuilder<E> multisetBuilder(); static MultisetBuilder<E> multisetBuilder(Class<E> elementClass); @Override Multiset<E> build(); @Override Multiset<E> build(Class<? extends Multiset> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction);  }