### Question:
EvalPayload { public List<EvalPayload> toBatches(int batchSize) { int size = metrics.size(); if (size <= batchSize) { return Collections.singletonList(this); } else { List<EvalPayload> payloads = new ArrayList<>(size / batchSize + 1); for (int i = 0; i < size; i += batchSize) { List<Metric> batch = metrics.subList(i, Math.min(size, i + batchSize)); List<Message> msgs = (i == 0) ? messages : Collections.emptyList(); payloads.add(new EvalPayload(timestamp, batch, msgs)); } return payloads; } } EvalPayload(long timestamp, List<Metric> metrics, List<Message> messages);  EvalPayload(long timestamp, List<Metric> metrics); long getTimestamp(); List<Metric> getMetrics(); List<Message> getMessages(); List<EvalPayload> toBatches(int batchSize); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void toBatchesBelowThreshold() { EvalPayload payload = new EvalPayload(0L, metrics(4)); List<EvalPayload> batches = payload.toBatches(4); Assertions.assertEquals(1, batches.size()); Assertions.assertSame(payload, batches.get(0)); }