@Test
  public void testPreviousChangelogPartitionsMaintained() {
    // existing changelog mapping has 2 tasks, but the job model ultimately will need 4 tasks
    // intentionally using an "out-of-order" changelog mapping to make sure it gets maintained
    Map<TaskName, Integer> changelogPartitionMapping = ImmutableMap.of(taskName(0), 1, taskName(1), 0);
    Config config = config(ImmutableList.of(SYSTEM_STREAM0, SYSTEM_STREAM1), ImmutableMap.of());
    // these task models have special changelog partitions from the previous mapping
    TaskModel taskModel0 = new TaskModel(taskName(0),
        ImmutableSet.of(new SystemStreamPartition(SYSTEM_STREAM0, new Partition(0)),
            new SystemStreamPartition(SYSTEM_STREAM1, new Partition(0))), new Partition(1));
    TaskModel taskModel1 = new TaskModel(taskName(1),
        ImmutableSet.of(new SystemStreamPartition(SYSTEM_STREAM0, new Partition(1)),
            new SystemStreamPartition(SYSTEM_STREAM1, new Partition(1))), new Partition(0));
    // tasks 2 and 3 will get assigned new changelog partitions
    Map<String, ContainerModel> containerModels = ImmutableMap.of("0",
        new ContainerModel("0", ImmutableMap.of(taskName(0), taskModel0, taskName(2), taskModel(2, 2, 2))), "1",
        new ContainerModel("1", ImmutableMap.of(taskName(1), taskModel1, taskName(3), taskModel(3, 3))));
    JobModel expected = new JobModel(config, containerModels);
    JobModel actual =
        JobModelCalculator.INSTANCE.calculateJobModel(config, changelogPartitionMapping, this.streamMetadataCache,
            this.grouperMetadata);
    assertEquals(expected, actual);
  }
Unfortunately, we still need powermock for testing the regex topic flow, since that flow checks for a specific
rewriter class, and setting up the support for that specific class is too cumbersome.
Many of the tests do not need powermock.
samza-core/src/test/java/org/apache/samza/coordinator/TestJobModelCalculator.java