### Question:
RepeatBuilder extends StreamBuilder { @Override public void process(Bundle row, StreamEmitter emitter) { long emitTimes = defaultRepeats; ValueObject repeatCount = repeatField.getValue(row); if (repeatCount != null) { try { emitTimes = repeatCount.asLong().getLong(); } catch (ValueTranslationException vte) { if (failOnParseException) { throw vte; } else { log.warn("Failed to parse repeats field value={}", repeatCount.asString().asNative()); } } } for (int i = 0; i < emitTimes; i++) { Bundle toEmit = copyBundle ? Bundles.deepCopyBundle(row) : row; emitter.emit(toEmit); } }  @Override void init(); @Override void process(Bundle row, StreamEmitter emitter);  }### Answer:
@Test public void basicFunctionality() throws IOException { int reps = 5; RepeatBuilder builder = decodeObject(RepeatBuilder.class, "repeatField: reps"); Bundle bundle = Bundles.decode("reps: " + reps); builder.process(bundle, emitter); verify(emitter, times(reps)).emit(bundle); }
@Test public void defaultRepeatCount() throws IOException { int defaultRepeatCount = 2; RepeatBuilder builder = decodeObject(RepeatBuilder.class, "repeatField: reps, defaultRepeats: " + defaultRepeatCount); Bundle bundle = new ListBundle(); builder.process(bundle, emitter); verify(emitter, times(defaultRepeatCount)).emit(bundle); }
@Test(expected = ValueTranslationException.class) public void escalateOnParseFailure() throws IOException { RepeatBuilder builder = decodeObject(RepeatBuilder.class, "repeatField: reps, failOnParseException: true"); Bundle bundle = Bundles.decode("reps: zzzzzz"); builder.process(bundle, emitter); }