/** cache - different arguments. */
 @Test
 public void cache_diff_argument() {
   UserOperator opA =
       load("parameterized").argument("parameterized", Descriptions.valueOf("a")).build();
   UserOperator opB =
       load("parameterized").argument("parameterized", Descriptions.valueOf("b")).build();
   NodeInfo a = generate(opA);
   NodeInfo b = generate(opB);
   assertThat("fold operator embeds its arguments", b, not(useCacheOf(a)));
 }
  /** parameterized. */
  @Test
  public void parameterized() {
    UserOperator operator = load("parameterized").argument("a", Descriptions.valueOf("?")).build();
    AggregateNodeInfo info = (AggregateNodeInfo) generate(operator);
    MockSink<MockDataModel> results = new MockSink<>();
    loading(
        info,
        c -> {
          // fold operator embeds its arguments
          Result<Object> r = c.newInstance(results);
          r.add(
              cogroup(
                  new Object[][] {
                    {
                      new MockDataModel(1, "A"), new MockDataModel(2, "A"),
                    }
                  }));
        });
    assertThat(results.get(e -> e.getKey()), contains(3));
    assertThat(results.get(e -> e.getValue()), contains("?"));

    loading(
        info.getCopierType(),
        c -> {
          @SuppressWarnings("unchecked")
          ObjectCopier<MockDataModel> obj = (ObjectCopier<MockDataModel>) c.newInstance();
          MockDataModel orig = new MockDataModel(1, "A");
          MockDataModel copy = obj.newCopy(orig);
          assertThat(copy.getKey(), is(orig.getKey()));
          assertThat(copy.getValue(), is(orig.getValue()));
          assertThat(copy, is(not(sameInstance(orig))));
        });
    loading(
        info.getCombinerType(),
        c -> {
          @SuppressWarnings("unchecked")
          ObjectCombiner<MockDataModel> obj = (ObjectCombiner<MockDataModel>) c.newInstance();
          MockDataModel a = new MockDataModel(1, "A");
          MockDataModel b = new MockDataModel(2, "B");
          obj.combine(a, b);
          assertThat(a.getKey(), is(3));
          assertThat(b.getKey(), is(2));
          assertThat(a.getValue(), is("?"));
          assertThat(b.getValue(), is("B"));
        });
  }
 private Builder load(String name) {
   return OperatorExtractor.extract(Fold.class, Op.class, name)
       .input("in", Descriptions.typeOf(MockDataModel.class), Groups.parse(Arrays.asList("key")))
       .output("out", Descriptions.typeOf(MockDataModel.class));
 }