@Override
  public void newChunk(final Item item) {
    Assert.assertNull("currentAggregatedItem shall be null at this point", currentAggregatedItem);
    Assert.assertNotNull("processorCtx shall be set at this point", processorCtx);
    Assert.assertNotNull(
        "processorCtx transaction shall be set at this point", processorCtx.getTrx());
    assertThreadInheritedTrxSet();

    final String groupKey = item.getGroupKey();
    if (errorOnNewChunkGroupKeys.contains(groupKey)) {
      throw new RuntimeException("Test exception on newChunk for group: " + groupKey);
    }
    currentAggregatedItem = new AggregatedItem(groupKey, processorCtx.getTrx().getTrxName());
  }
  private void assertThreadInheritedTrxSet() {
    final String trxName = trxManager.getThreadInheritedTrxName();
    Assert.assertTrue(
        "Thread inherited transaction shall be set at this point", !trxManager.isNull(trxName));

    Assert.assertEquals(
        "Thread inherited transaction shall match context transaction",
        processorCtx.getTrxName(),
        trxName);

    if (expectTrxSavepoints != null) {
      final PlainTrx trx = (PlainTrx) processorCtx.getTrx();
      Assert.assertEquals(
          "Active savepoints for " + trx, expectTrxSavepoints, trx.hasActiveSavepoints());
    }
  }