@Test public void capabilityOfShrinkingDependsOnComponents() { when(first.canShrink(9)).thenReturn(true); when(second.canShrink(9)).thenReturn(false); when(third.canShrink(9)).thenReturn(true); assertTrue(composite.canShrink(9)); }
@Override public boolean canShrink(Object larger) { return composed.stream() .map(w -> w.item) .anyMatch(g -> g.canShrink(larger)); }
CompositeGenerator extends Generator<Object> { @Override public boolean canShrink(Object larger) { return composed.stream() .map(w -> w.item) .anyMatch(g -> g.canShrink(larger)); } }
CompositeGenerator extends Generator<Object> { @Override public boolean canShrink(Object larger) { return composed.stream() .map(w -> w.item) .anyMatch(g -> g.canShrink(larger)); } CompositeGenerator(List<Weighted<Generator<?>>> composed); }
CompositeGenerator extends Generator<Object> { @Override public boolean canShrink(Object larger) { return composed.stream() .map(w -> w.item) .anyMatch(g -> g.canShrink(larger)); } CompositeGenerator(List<Weighted<Generator<?>>> composed); @Override Object generate(SourceOfRandomness random, GenerationStatus status); @Override boolean canShrink(Object larger); @Override List<Object> doShrink(SourceOfRandomness random, Object larger); Generator<?> composed(int index); int numberOfComposedGenerators(); @Override void provide(Generators provided); @Override BigDecimal magnitude(Object value); @Override void configure(AnnotatedType annotatedType); @Override void configure(AnnotatedElement element); @Override void addComponentGenerators(List<Generator<?>> newComponents); }
CompositeGenerator extends Generator<Object> { @Override public boolean canShrink(Object larger) { return composed.stream() .map(w -> w.item) .anyMatch(g -> g.canShrink(larger)); } CompositeGenerator(List<Weighted<Generator<?>>> composed); @Override Object generate(SourceOfRandomness random, GenerationStatus status); @Override boolean canShrink(Object larger); @Override List<Object> doShrink(SourceOfRandomness random, Object larger); Generator<?> composed(int index); int numberOfComposedGenerators(); @Override void provide(Generators provided); @Override BigDecimal magnitude(Object value); @Override void configure(AnnotatedType annotatedType); @Override void configure(AnnotatedElement element); @Override void addComponentGenerators(List<Generator<?>> newComponents);  }