public static <T> Partition<T> of(
      int numPartitions,
      PartitionWithSideInputsFn<? super T> partitionFn,
      Requirements requirements) {
    Contextful ctfFn =
        Contextful.fn(
            (T element, Contextful.Fn.Context c) ->
                partitionFn.partitionFor(element, numPartitions, c),
            requirements);
    return new Partition<>(new PartitionDoFn<T>(numPartitions, ctfFn, partitionFn));
  }
@Test
  public void testDisplayData() {
    Partition<?> partition = Partition.of(123, new IdentityFn());
    DisplayData displayData = DisplayData.from(partition);

    assertThat(displayData, hasDisplayItem("numPartitions", 123));
    assertThat(displayData, hasDisplayItem("partitionFn", IdentityFn.class));
  }