@Test public void testTwoParameters() { String result = MessageFormatter.format("Value {} is smaller than {}.", 1, 2).getMessage(); assertEquals("Value 1 is smaller than 2.", result); result = MessageFormatter.format("Value {} is smaller than {}", 1, 2).getMessage(); assertEquals("Value 1 is smaller than 2", result); result = MessageFormatter.format("{}{}", 1, 2).getMessage(); assertEquals("12", result); result = MessageFormatter.format("Val1={}, Val2={", 1, 2).getMessage(); assertEquals("Val1=1, Val2={", result); result = MessageFormatter.format("Value {} is smaller than \\{}", 1, 2).getMessage(); assertEquals("Value 1 is smaller than {}", result); result = MessageFormatter.format("Value {} is smaller than \\{} tail", 1, 2).getMessage(); assertEquals("Value 1 is smaller than {} tail", result); result = MessageFormatter.format("Value {} is smaller than \\{", 1, 2).getMessage(); assertEquals("Value 1 is smaller than \\{", result); result = MessageFormatter.format("Value {} is smaller than {tail", 1, 2).getMessage(); assertEquals("Value 1 is smaller than {tail", result); result = MessageFormatter.format("Value \\{} is smaller than {}", 1, 2).getMessage(); assertEquals("Value {} is smaller than 1", result); }
static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); }
MessageFormatter { static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); } }
MessageFormatter { static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); } private  MessageFormatter(); }
MessageFormatter { static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); } private  MessageFormatter();  }
MessageFormatter { static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); } private  MessageFormatter();   }