public static Collection<PValue> nonAdditionalInputs(AppliedPTransform<?, ?, ?> application) {
    ImmutableList.Builder<PValue> mainInputs = ImmutableList.builder();
    PTransform<?, ?> transform = application.getTransform();
    for (Map.Entry<TupleTag<?>, PCollection<?>> input : application.getInputs().entrySet()) {
      if (!transform.getAdditionalInputs().containsKey(input.getKey())) {
        mainInputs.add(input.getValue());
      }
    }
    checkArgument(
        !mainInputs.build().isEmpty() || application.getInputs().isEmpty(),
        "Expected at least one main input if any inputs exist");
    return mainInputs.build();
  }
@Test
  public void nonAdditionalInputsWithOnlyAdditionalInputsThrows() {
    Map<TupleTag<?>, PCollection<?>> additionalInputs = new HashMap<>();
    additionalInputs.put(new TupleTag<String>() {}, pipeline.apply(Create.of("1, 2", "3")));
    additionalInputs.put(new TupleTag<Long>() {}, pipeline.apply(GenerateSequence.from(3L)));

    AppliedPTransform<PInput, POutput, TestTransform> transform =
        AppliedPTransform.of(
            "additional-only",
            additionalInputs,
            Collections.emptyMap(),
            new TestTransform((Map) additionalInputs),
            ResourceHints.create(),
            pipeline);

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("at least one");
    TransformInputs.nonAdditionalInputs(transform);
  }