@Test
  public void testAllDeprecated() {
    String[] values = new String[] {"like_text", "likeText"};

    boolean withDeprecatedNames = randomBoolean();
    String[] deprecated = new String[] {"text", "same_as_text"};
    String[] allValues = values;
    if (withDeprecatedNames) {
      allValues = ArrayUtils.addAll(values, deprecated);
    }

    ParseField field = new ParseField(randomFrom(values));
    if (withDeprecatedNames) {
      field = field.withDeprecation(deprecated);
    }
    field = field.withAllDeprecated("like");

    // strict mode off
    assertThat(field.match(randomFrom(allValues), ParseField.EMPTY_FLAGS), is(true));
    assertThat(field.match("not a field name", ParseField.EMPTY_FLAGS), is(false));

    // now with strict mode
    EnumSet<ParseField.Flag> flags = EnumSet.of(ParseField.Flag.STRICT);
    try {
      field.match(randomFrom(allValues), flags);
      fail();
    } catch (IllegalArgumentException ex) {
    }
  }