private void createPartitionedRegion(String regionName,
      String asyncEventQueueId,
      long recoveryDelay,
      int redundantCopies,
      int totalNumBuckets) {
    assertThat(regionName).isNotEmpty();
    assertThat(asyncEventQueueId).isNotEmpty();

    PartitionAttributesFactory<?, ?> partitionAttributesFactory = new PartitionAttributesFactory();
    partitionAttributesFactory.setRecoveryDelay(recoveryDelay);
    partitionAttributesFactory.setRedundantCopies(redundantCopies);
    partitionAttributesFactory.setTotalNumBuckets(totalNumBuckets);

    RegionFactory<?, ?> regionFactory = getCache().createRegionFactory(PARTITION);
    if (asyncEventQueueId != null) {
      regionFactory.addAsyncEventQueueId(asyncEventQueueId);
    }
    regionFactory.setPartitionAttributes(partitionAttributesFactory.create());

    configureRegion(regionFactory).create(regionName);
  }
Regression test for TRAC #50366: NullPointerException with AsyncEventQueue#size() when number
of dispatchers is more than 1
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/wan/asyncqueue/ConcurrentAsyncEventListenerDistributedTest.java