@Test public void testParseBraceFormat() throws ParseException { MessageBuilder<?> builder = mock(MessageBuilder.class); PARSER.parseBraceFormatTerm(builder, 1, "Hello {1} World", 6, -1, 9); ArgumentCaptor<Parameter> param = ArgumentCaptor.forClass(Parameter.class); verify(builder).addParameterImpl(eq(6), eq(9), param.capture()); assertThat(param.getValue().getIndex()).isEqualTo(1); ParameterVisitor out = mock(ParameterVisitor.class); param.getValue().accept(out, new Object[] {"Answer: ", 42}); verify(out).visit(eq(42), eq(FormatChar.DECIMAL), eq(WITH_GROUPING)); }
@Override public void parseBraceFormatTerm( MessageBuilder<?> builder, int index, String message, int termStart, int formatStart, int termEnd) throws ParseException { if (formatStart != -1) { throw ParseException.withBounds( "the default brace style parser does not allow trailing format specifiers", message, formatStart - 1, termEnd - 1); } builder.addParameter(termStart, termEnd, BraceStyleParameter.of(index)); }
DefaultBraceStyleMessageParser extends BraceStyleMessageParser { @Override public void parseBraceFormatTerm( MessageBuilder<?> builder, int index, String message, int termStart, int formatStart, int termEnd) throws ParseException { if (formatStart != -1) { throw ParseException.withBounds( "the default brace style parser does not allow trailing format specifiers", message, formatStart - 1, termEnd - 1); } builder.addParameter(termStart, termEnd, BraceStyleParameter.of(index)); } }
DefaultBraceStyleMessageParser extends BraceStyleMessageParser { @Override public void parseBraceFormatTerm( MessageBuilder<?> builder, int index, String message, int termStart, int formatStart, int termEnd) throws ParseException { if (formatStart != -1) { throw ParseException.withBounds( "the default brace style parser does not allow trailing format specifiers", message, formatStart - 1, termEnd - 1); } builder.addParameter(termStart, termEnd, BraceStyleParameter.of(index)); } private  DefaultBraceStyleMessageParser(); }
DefaultBraceStyleMessageParser extends BraceStyleMessageParser { @Override public void parseBraceFormatTerm( MessageBuilder<?> builder, int index, String message, int termStart, int formatStart, int termEnd) throws ParseException { if (formatStart != -1) { throw ParseException.withBounds( "the default brace style parser does not allow trailing format specifiers", message, formatStart - 1, termEnd - 1); } builder.addParameter(termStart, termEnd, BraceStyleParameter.of(index)); } private  DefaultBraceStyleMessageParser(); static BraceStyleMessageParser getInstance(); @Override void parseBraceFormatTerm(
      MessageBuilder<?> builder,
      int index,
      String message,
      int termStart,
      int formatStart,
      int termEnd); }
DefaultBraceStyleMessageParser extends BraceStyleMessageParser { @Override public void parseBraceFormatTerm( MessageBuilder<?> builder, int index, String message, int termStart, int formatStart, int termEnd) throws ParseException { if (formatStart != -1) { throw ParseException.withBounds( "the default brace style parser does not allow trailing format specifiers", message, formatStart - 1, termEnd - 1); } builder.addParameter(termStart, termEnd, BraceStyleParameter.of(index)); } private  DefaultBraceStyleMessageParser(); static BraceStyleMessageParser getInstance(); @Override void parseBraceFormatTerm(
      MessageBuilder<?> builder,
      int index,
      String message,
      int termStart,
      int formatStart,
      int termEnd);  }