@Test public void shouldFailWhenTypeDoesNotHaveOneArgConstructor() { expectedException.expect(RuntimeException.class); TypeGenerator<Object, Integer> typeGenerator = new TypeGenerator<>(Object.class, Generators.positiveInts); typeGenerator.next(); }
@Override @SuppressWarnings("unchecked") public T next() { V next = valueGenerator.next(); lookupConstructor(typeClass, next.getClass()); try { return (T) constructor.invoke(next); } catch (Throwable throwable) { throw propagate(throwable); } }
TypeGenerator implements Generator<T> { @Override @SuppressWarnings("unchecked") public T next() { V next = valueGenerator.next(); lookupConstructor(typeClass, next.getClass()); try { return (T) constructor.invoke(next); } catch (Throwable throwable) { throw propagate(throwable); } } }
TypeGenerator implements Generator<T> { @Override @SuppressWarnings("unchecked") public T next() { V next = valueGenerator.next(); lookupConstructor(typeClass, next.getClass()); try { return (T) constructor.invoke(next); } catch (Throwable throwable) { throw propagate(throwable); } } TypeGenerator(@Nonnull Class<T> typeClass, @Nonnull Generator<V> valueGenerator); }
TypeGenerator implements Generator<T> { @Override @SuppressWarnings("unchecked") public T next() { V next = valueGenerator.next(); lookupConstructor(typeClass, next.getClass()); try { return (T) constructor.invoke(next); } catch (Throwable throwable) { throw propagate(throwable); } } TypeGenerator(@Nonnull Class<T> typeClass, @Nonnull Generator<V> valueGenerator); @Override @SuppressWarnings("unchecked") T next(); }
TypeGenerator implements Generator<T> { @Override @SuppressWarnings("unchecked") public T next() { V next = valueGenerator.next(); lookupConstructor(typeClass, next.getClass()); try { return (T) constructor.invoke(next); } catch (Throwable throwable) { throw propagate(throwable); } } TypeGenerator(@Nonnull Class<T> typeClass, @Nonnull Generator<V> valueGenerator); @Override @SuppressWarnings("unchecked") T next();  }