public void testCheckIcuEscapingIsNotNeeded() {

    IcuSyntaxUtils.checkIcuEscapingIsNotNeeded("");
    IcuSyntaxUtils.checkIcuEscapingIsNotNeeded("Hello world!");
    IcuSyntaxUtils.checkIcuEscapingIsNotNeeded("Don't");
    IcuSyntaxUtils.checkIcuEscapingIsNotNeeded("#5"); // no escape because we disable ICU '#'

    String expectedErrorMsgForNotSingleQuote =
        "Apologies, Soy currently does not support open/close brace characters in plural/gender"
            + " source msgs.";
    assertCheckIcuEscapingIsNotNeededFails("Set {0, 1, ...}", expectedErrorMsgForNotSingleQuote);
    assertCheckIcuEscapingIsNotNeededFails("Set {don't}", expectedErrorMsgForNotSingleQuote);
    assertCheckIcuEscapingIsNotNeededFails("Set '{0, 1, ...}'", expectedErrorMsgForNotSingleQuote);

    String expectedErrorMsgForSingleQuoteAtEnd =
        "Apologies, Soy currently does not support a single quote character at the end of a"
            + " text part in plural/gender source msgs (including immediately preceding an HTML"
            + " tag or Soy tag).";
    assertCheckIcuEscapingIsNotNeededFails("the '", expectedErrorMsgForSingleQuoteAtEnd);

    String expectedErrorMsgForSingleQuoteBeforeHash =
        "Apologies, Soy currently does not support a single quote character preceding a hash"
            + " character in plural/gender source msgs.";
    assertCheckIcuEscapingIsNotNeededFails("'#5", expectedErrorMsgForSingleQuoteBeforeHash);

    String expectedErrorMsgForConsecSingleQuote =
        "Apologies, Soy currently does not support consecutive single quote characters in"
            + " plural/gender source msgs.";
    assertCheckIcuEscapingIsNotNeededFails("Don''t", expectedErrorMsgForConsecSingleQuote);
    assertCheckIcuEscapingIsNotNeededFails("Don'''t", expectedErrorMsgForConsecSingleQuote);
    assertCheckIcuEscapingIsNotNeededFails("the ''", expectedErrorMsgForConsecSingleQuote);
  }
  private void assertCheckIcuEscapingIsNotNeededFails(
      String rawText, String expectedErrorMsgSubstr) {

    try {
      IcuSyntaxUtils.checkIcuEscapingIsNotNeeded(rawText);
      fail();
    } catch (SoySyntaxException sse) {
      assertThat(sse.getMessage()).contains(expectedErrorMsgSubstr);
    }
  }
 public void testIcuEscape() {
   assertThat(IcuSyntaxUtils.icuEscape("")).isEmpty();
   assertThat(IcuSyntaxUtils.icuEscape("Hello world!")).isEqualTo("Hello world!");
   assertThat(IcuSyntaxUtils.icuEscape("Don't")).isEqualTo("Don't");
   assertThat(IcuSyntaxUtils.icuEscape("#5")).isEqualTo("#5");
   // no escape because we disable ICU '#'
   assertThat(IcuSyntaxUtils.icuEscape("Don''t")).isEqualTo("Don'''t");
   assertThat(IcuSyntaxUtils.icuEscape("Don'''t")).isEqualTo("Don'''''t");
   assertThat(IcuSyntaxUtils.icuEscape("the '")).isEqualTo("the ''");
   assertThat(IcuSyntaxUtils.icuEscape("the ''")).isEqualTo("the ''''");
   assertThat(IcuSyntaxUtils.icuEscape("'#5")).isEqualTo("''#5");
   assertThat(IcuSyntaxUtils.icuEscape("Set {0, 1, ...}")).isEqualTo("Set '{'0, 1, ...'}'");
   assertThat(IcuSyntaxUtils.icuEscape("Set {don't}")).isEqualTo("Set '{'don't'}'");
   assertThat(IcuSyntaxUtils.icuEscape("Set '{0, 1, ...}'")).isEqualTo("Set '''{'0, 1, ...'}'''");
 }