public static void trimRecordTemplate(RecordTemplate recordTemplate, MaskTree override, final boolean failOnMismatch)
  {
    trimRecordTemplate(recordTemplate.data(), recordTemplate.schema(), override, failOnMismatch);
  }
@Test
  public void testRecursiveBasic() throws CloneNotSupportedException
  {
    LinkedListNode node1 = new LinkedListNode();
    node1.setIntField(1);

    LinkedListNode node2 = new LinkedListNode();
    node2.setIntField(2);
    node1.setNext(node2);

    RecordTemplate expected = node1.copy();

    // Introduce bad elements.
    node1.data().put("foo", "bar");
    node2.data().put("foo", "bar");

    Assert.assertEquals(node1.getIntField().intValue(), 1);
    Assert.assertEquals(node1.getNext(), node2);
    Assert.assertEquals(node1.data().size(), 3);

    Assert.assertEquals(node2.getIntField().intValue(), 2);
    Assert.assertEquals(node2.getNext(), null);
    Assert.assertEquals(node2.data().size(), 2);

    RestUtils.trimRecordTemplate(node1, false);
    Assert.assertEquals(node1, expected);
  }