|
15 | 15 | */ |
16 | 16 | package org.springframework.data.redis.core; |
17 | 17 |
|
18 | | -import static org.junit.Assert.assertEquals; |
19 | | -import static org.junit.Assert.assertFalse; |
20 | | -import static org.junit.Assert.assertThat; |
21 | | -import static org.junit.Assert.assertTrue; |
22 | | -import static org.junit.Assume.assumeTrue; |
23 | | -import static org.junit.Assert.assertNotNull; |
24 | | -import static org.springframework.data.redis.SpinBarrier.waitFor; |
25 | | -import static org.springframework.data.redis.matcher.RedisTestMatchers.isEqual; |
| 18 | +import static org.junit.Assert.*; |
| 19 | +import static org.junit.Assume.*; |
| 20 | +import static org.springframework.data.redis.SpinBarrier.*; |
| 21 | +import static org.springframework.data.redis.matcher.RedisTestMatchers.*; |
26 | 22 |
|
27 | 23 | import java.text.DecimalFormat; |
28 | 24 | import java.util.ArrayList; |
29 | 25 | import java.util.Arrays; |
30 | 26 | import java.util.Collection; |
31 | 27 | import java.util.HashMap; |
| 28 | +import java.util.Locale; |
32 | 29 | import java.util.Map; |
33 | 30 | import java.util.concurrent.TimeUnit; |
34 | 31 |
|
@@ -99,14 +96,20 @@ public void testIncrementLong() throws Exception { |
99 | 96 | assertEquals(Long.valueOf((Long)v1 - 20), (Long)valueOps.get(key)); |
100 | 97 | } |
101 | 98 |
|
| 99 | + |
| 100 | +/** |
| 101 | + * @see DATAREDIS-247 |
| 102 | + */ |
102 | 103 | @Test |
103 | 104 | public void testIncrementDouble() { |
| 105 | + |
104 | 106 | assumeTrue(RedisTestProfileValueSource.matches("redisVersion", "2.6")); |
105 | 107 | K key = keyFactory.instance(); |
106 | 108 | V v1 = valueFactory.instance(); |
107 | 109 | assumeTrue(v1 instanceof Double); |
108 | 110 | valueOps.set(key, v1); |
109 | | -DecimalFormat twoDForm = new DecimalFormat("#.##"); |
| 111 | +DecimalFormat twoDForm = (DecimalFormat) DecimalFormat.getInstance(Locale.US); |
| 112 | + |
110 | 113 | assertEquals(Double.valueOf(twoDForm.format((Double)v1 + 1.4)), valueOps.increment(key, 1.4)); |
111 | 114 | assertEquals(Double.valueOf(twoDForm.format((Double)v1 + 1.4)), valueOps.get(key)); |
112 | 115 | valueOps.increment(key, -10d); |
|
0 commit comments