incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [1/2] git commit: S4-127 fix format string
Date Sun, 10 Mar 2013 10:11:18 GMT
S4-127 fix format string


Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/a4b5eefb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/a4b5eefb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/a4b5eefb

Branch: refs/heads/dev
Commit: a4b5eefb88da9e2ecc8bf8473d94255e448419a1
Parents: a5aacb1
Author: Daniel Gómez Ferro <dferro@apache.org>
Authored: Sat Mar 9 22:26:54 2013 +0100
Committer: Daniel Gómez Ferro <dferro@apache.org>
Committed: Sat Mar 9 22:26:54 2013 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/s4/tools/Status.java  |    2 +-
 .../test/java/org/apache/s4/tools/TestStatus.java  |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/a4b5eefb/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Status.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Status.java b/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Status.java
index 63fd077..1d9bd45 100644
--- a/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Status.java
+++ b/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Status.java
@@ -209,7 +209,7 @@ public class Status extends S4ArgsBase {
             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) {

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/a4b5eefb/subprojects/s4-tools/src/test/java/org/apache/s4/tools/TestStatus.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-tools/src/test/java/org/apache/s4/tools/TestStatus.java b/subprojects/s4-tools/src/test/java/org/apache/s4/tools/TestStatus.java
index 7c7bae9..049152f 100644
--- a/subprojects/s4-tools/src/test/java/org/apache/s4/tools/TestStatus.java
+++ b/subprojects/s4-tools/src/test/java/org/apache/s4/tools/TestStatus.java
@@ -11,7 +11,9 @@ public class TestStatus {
     @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);
 
     }


Mime
View raw message