Permalink
Browse files

S4-127 fix format string

  • Loading branch information...
1 parent a5aacb1 commit a4b5eefb88da9e2ecc8bf8473d94255e448419a1 Daniel Gómez Ferro committed Mar 9, 2013
@@ -209,7 +209,7 @@ static String inMiddle(String content, int width) {
content = "UNDEFINED";
}
int i = (width - content.length()) / 2;
- return String.format("%" + (i == 0 ? "" : (i + "s")) + "%s", " ", content);
+ return String.format("%" + (i == 0 ? "s" : (i + "s")) + "%s", " ", content);
}
private static String generateEdge(int length) {
@@ -11,7 +11,9 @@
@Test
public void testStringFormatting() {
- Status.inMiddle(Strings.repeat("A", 20), 20);
+ String repeat = Strings.repeat("A", 20);
+ String middle = Status.inMiddle(repeat, 20);
+ Assert.assertTrue(middle.contains(repeat));
Assert.assertTrue("Failed to parse correctly", true);
}

0 comments on commit a4b5eef

Please sign in to comment.