@@ -22,6 +22,8 @@ import scala.util.Random
2222import java .io .{File , ByteArrayOutputStream , ByteArrayInputStream , FileOutputStream }
2323import java .net .{BindException , ServerSocket , URI }
2424import java .nio .{ByteBuffer , ByteOrder }
25+ import java .text .DecimalFormatSymbols
26+ import java .util .Locale
2527
2628import com .google .common .base .Charsets
2729import com .google .common .io .Files
@@ -101,14 +103,16 @@ class UtilsSuite extends FunSuite {
101103 val hour = minute * 60
102104 def str = Utils .msDurationToString(_)
103105
106+ val sep = new DecimalFormatSymbols (Locale .getDefault()).getDecimalSeparator()
107+
104108 assert(str(123 ) === " 123 ms" )
105- assert(str(second) === " 1. 0 s" )
106- assert(str(second + 462 ) === " 1. 5 s" )
107- assert(str(hour) === " 1. 00 h" )
108- assert(str(minute) === " 1. 0 m" )
109- assert(str(minute + 4 * second + 34 ) === " 1. 1 m" )
110- assert(str(10 * hour + minute + 4 * second) === " 10. 02 h" )
111- assert(str(10 * hour + 59 * minute + 59 * second + 999 ) === " 11. 00 h" )
109+ assert(str(second) === " 1" + sep + " 0 s" )
110+ assert(str(second + 462 ) === " 1" + sep + " 5 s" )
111+ assert(str(hour) === " 1" + sep + " 00 h" )
112+ assert(str(minute) === " 1" + sep + " 0 m" )
113+ assert(str(minute + 4 * second + 34 ) === " 1" + sep + " 1 m" )
114+ assert(str(10 * hour + minute + 4 * second) === " 10" + sep + " 02 h" )
115+ assert(str(10 * hour + 59 * minute + 59 * second + 999 ) === " 11" + sep + " 00 h" )
112116 }
113117
114118 test(" reading offset bytes of a file" ) {
@@ -271,12 +275,11 @@ class UtilsSuite extends FunSuite {
271275 assert(! Utils .isBindCollision(new Exception ))
272276 assert(! Utils .isBindCollision(new Exception (new Exception )))
273277 assert(! Utils .isBindCollision(new Exception (new BindException )))
274- assert(! Utils .isBindCollision(new Exception (new BindException (" Random message" ))))
275278
276279 // Positives
277- val be = new BindException (" Address already in use " )
278- val be1 = new Exception (new BindException (" Address already in use " ))
279- val be2 = new Exception (new Exception (new BindException (" Address already in use " )))
280+ val be = new BindException (" Random Message " )
281+ val be1 = new Exception (new BindException (" Random Message " ))
282+ val be2 = new Exception (new Exception (new BindException (" Random Message " )))
280283 assert(Utils .isBindCollision(be))
281284 assert(Utils .isBindCollision(be1))
282285 assert(Utils .isBindCollision(be2))
0 commit comments