diff --git a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java index 49e90678fe..650dbcbcae 100644 --- a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java +++ b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java @@ -114,17 +114,19 @@ public class NetworkStressTest { /** Print a progress bar based on the given character. */ private void printProgress(char c, int n) { + if (n < 1) + return; // nothing to represent + long now = System.currentTimeMillis(); - if (now - lastProgressUpdateMillis < 500) - return; // throttle message printing below half a second + if ((n != 1) && ((now - lastProgressUpdateMillis) < 500)) + return; // throttle message printing below half a second (but last one is always printed) lastProgressUpdateMillis = now; - if (n > 0) { - String hdr = String.format("\r%s> ", this.getClass().getSimpleName()); - String msg = (hdr.length() - 1/*carriage return*/ + n + 1/*final space*/ > terminalColumns) - ? String.format("%c*%d", c, n) - : nChars(c, n); - System.out.print(hdr + msg + ' '); - } + + String hdr = String.format("\r%s> ", this.getClass().getSimpleName()); + String msg = (hdr.length() - 1/*carriage return*/ + n + 1/*final space*/ > terminalColumns) + ? String.format("%c*%d", c, n) + : nChars(c, n); + System.out.print(hdr + msg + ' '); if (n == 1) System.out.print('\n'); System.out.flush();