@@ -22,6 +22,8 @@ import scala.util.Random
22
22
import java .io .{File , ByteArrayOutputStream , ByteArrayInputStream , FileOutputStream }
23
23
import java .net .{BindException , ServerSocket , URI }
24
24
import java .nio .{ByteBuffer , ByteOrder }
25
+ import java .text .DecimalFormatSymbols
26
+ import java .util .Locale
25
27
26
28
import com .google .common .base .Charsets .UTF_8
27
29
import com .google .common .io .Files
@@ -103,14 +105,16 @@ class UtilsSuite extends FunSuite {
103
105
val hour = minute * 60
104
106
def str = Utils .msDurationToString(_)
105
107
108
+ val sep = new DecimalFormatSymbols (Locale .getDefault()).getDecimalSeparator()
109
+
106
110
assert(str(123 ) === " 123 ms" )
107
- assert(str(second) === " 1. 0 s" )
108
- assert(str(second + 462 ) === " 1. 5 s" )
109
- assert(str(hour) === " 1. 00 h" )
110
- assert(str(minute) === " 1. 0 m" )
111
- assert(str(minute + 4 * second + 34 ) === " 1. 1 m" )
112
- assert(str(10 * hour + minute + 4 * second) === " 10. 02 h" )
113
- assert(str(10 * hour + 59 * minute + 59 * second + 999 ) === " 11. 00 h" )
111
+ assert(str(second) === " 1" + sep + " 0 s" )
112
+ assert(str(second + 462 ) === " 1" + sep + " 5 s" )
113
+ assert(str(hour) === " 1" + sep + " 00 h" )
114
+ assert(str(minute) === " 1" + sep + " 0 m" )
115
+ assert(str(minute + 4 * second + 34 ) === " 1" + sep + " 1 m" )
116
+ assert(str(10 * hour + minute + 4 * second) === " 10" + sep + " 02 h" )
117
+ assert(str(10 * hour + 59 * minute + 59 * second + 999 ) === " 11" + sep + " 00 h" )
114
118
}
115
119
116
120
test(" reading offset bytes of a file" ) {
@@ -284,12 +288,11 @@ class UtilsSuite extends FunSuite {
284
288
assert(! Utils .isBindCollision(new Exception ))
285
289
assert(! Utils .isBindCollision(new Exception (new Exception )))
286
290
assert(! Utils .isBindCollision(new Exception (new BindException )))
287
- assert(! Utils .isBindCollision(new Exception (new BindException (" Random message" ))))
288
291
289
292
// Positives
290
- val be = new BindException (" Address already in use " )
291
- val be1 = new Exception (new BindException (" Address already in use " ))
292
- val be2 = new Exception (new Exception (new BindException (" Address already in use " )))
293
+ val be = new BindException (" Random Message " )
294
+ val be1 = new Exception (new BindException (" Random Message " ))
295
+ val be2 = new Exception (new Exception (new BindException (" Random Message " )))
293
296
assert(Utils .isBindCollision(be))
294
297
assert(Utils .isBindCollision(be1))
295
298
assert(Utils .isBindCollision(be2))
0 commit comments