Test impact on Pair of being Formattable

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1099414 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2011-05-04 11:13:51 +00:00
parent f1db2dda80
commit 7699d19aaa
1 changed files with 13 additions and 1 deletions

View File

@ -105,5 +105,17 @@ public class PairTest {
Pair<String, Calendar> pair = Pair.of("DOB", date);
assertEquals("Test created on " + "04-25-2011", pair.toString("Test created on %2$tm-%2$td-%2$tY"));
}
@Test
public void testFormattable_simple() throws Exception {
Pair<String, String> pair = Pair.of("Key", "Value");
assertEquals("(Key,Value)", String.format("%1$s", pair));
}
@Test
public void testFormattable_padded() throws Exception {
Pair<String, String> pair = Pair.of("Key", "Value");
assertEquals(" (Key,Value)", String.format("%1$20s", pair));
}
}