public static <T> PCollection<T> getSingletonMainInput(
      AppliedPTransform<? extends PCollection<? extends T>, ?, ?> application) {
    return getSingletonMainInput(
        application.getInputs(), application.getTransform().getAdditionalInputs().keySet());
  }
@Test
  public void getMainInputExtraMainInputsThrows() {
    PCollection<Long> notInParDo = pipeline.apply("otherPCollection", Create.of(1L, 2L, 3L));
    ImmutableMap<TupleTag<?>, PCollection<?>> inputs =
        ImmutableMap.<TupleTag<?>, PCollection<?>>builder()
            .putAll(PValues.expandInput(mainInput))
            // Not represnted as an input
            .put(new TupleTag<Long>(), notInParDo)
            .put(sideInput.getTagInternal(), sideInput.getPCollection())
            .build();
    AppliedPTransform<PCollection<Long>, ?, ?> application =
        AppliedPTransform.of(
            "application",
            inputs,
            Collections.singletonMap(new TupleTag<Long>(), output),
            ParDo.of(new TestDoFn()).withSideInputs(sideInput),
            ResourceHints.create(),
            pipeline);
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("multiple inputs");
    thrown.expectMessage("not additional inputs");
    thrown.expectMessage(mainInput.toString());
    thrown.expectMessage(notInParDo.toString());
    PTransformReplacements.getSingletonMainInput(application);
  }