@VisibleForTesting
  static boolean onlyContainsSpecifiersInAllowList(String pattern) {
    var noSpecifierFormatBase = SPECIFIER_ALLOW_LIST_REGEX.matcher(pattern).replaceAll("");
    // If it still has a specifier after the replacement, it means that it was not on the allowlist.
    return !noSpecifierFormatBase.contains("%");
  }
@Test
  public void testOnlyContainsSpecifiersInAllowList() {
    assertTrue(onlyContainsSpecifiersInAllowList("%%%n%b%h%c%s"));
    assertTrue(onlyContainsSpecifiersInAllowList("%1$s%<s%1s%1.2s%2$-3.4s%<-42s"));
    // Implies a Formattable argument, so no need to match here
    assertFalse(onlyContainsSpecifiersInAllowList("%#s"));
    // Use locale-aware uppercase
    assertFalse(onlyContainsSpecifiersInAllowList("%S"));
    assertFalse(onlyContainsSpecifiersInAllowList("%B"));
    assertFalse(onlyContainsSpecifiersInAllowList("%H"));
    assertFalse(onlyContainsSpecifiersInAllowList("%C"));
    // Use locale-aware formatting
    assertFalse(onlyContainsSpecifiersInAllowList("%d"));
    assertFalse(onlyContainsSpecifiersInAllowList("%o"));
    assertFalse(onlyContainsSpecifiersInAllowList("%x"));
    assertFalse(onlyContainsSpecifiersInAllowList("%X"));
    assertFalse(onlyContainsSpecifiersInAllowList("%e"));
    assertFalse(onlyContainsSpecifiersInAllowList("%E"));
    assertFalse(onlyContainsSpecifiersInAllowList("%f"));
    assertFalse(onlyContainsSpecifiersInAllowList("%g"));
    assertFalse(onlyContainsSpecifiersInAllowList("%G"));
    assertFalse(onlyContainsSpecifiersInAllowList("%a"));
    assertFalse(onlyContainsSpecifiersInAllowList("%A"));
    assertFalse(onlyContainsSpecifiersInAllowList("%tc"));
    assertFalse(onlyContainsSpecifiersInAllowList("%Tc"));
  }