public static NameMapping of(MappedField... fields) {
    return new NameMapping(MappedFields.of(ImmutableList.copyOf(fields)));
  }
@Test
  public void testFailsDuplicateName() {
    assertThatThrownBy(
            () -> new NameMapping(MappedFields.of(MappedField.of(1, "x"), MappedField.of(2, "x"))))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessage("Multiple entries with same key: x=2 and x=1");
  }