diff --git a/.gitignore b/.gitignore index 1e482d3e7..b060d5854 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ pom.xml *.log .classpath .project -.settings \ No newline at end of file +.settings +.idea +out \ No newline at end of file diff --git a/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsTests.java b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsTests.java index 5b1bfb43e..e4edc087c 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsTests.java @@ -15,20 +15,17 @@ */ package org.springframework.data.redis.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeTrue; -import static org.junit.Assert.assertNotNull; -import static org.springframework.data.redis.SpinBarrier.waitFor; -import static org.springframework.data.redis.matcher.RedisTestMatchers.isEqual; +import static org.junit.Assert.*; +import static org.junit.Assume.*; +import static org.springframework.data.redis.SpinBarrier.*; +import static org.springframework.data.redis.matcher.RedisTestMatchers.*; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -99,14 +96,20 @@ public class DefaultValueOperationsTests { assertEquals(Long.valueOf((Long)v1 - 20), (Long)valueOps.get(key)); } + + /** + * @see DATAREDIS-247 + */ @Test public void testIncrementDouble() { + assumeTrue(RedisTestProfileValueSource.matches("redisVersion", "2.6")); K key = keyFactory.instance(); V v1 = valueFactory.instance(); assumeTrue(v1 instanceof Double); valueOps.set(key, v1); - DecimalFormat twoDForm = new DecimalFormat("#.##"); + DecimalFormat twoDForm = (DecimalFormat) DecimalFormat.getInstance(Locale.US); + assertEquals(Double.valueOf(twoDForm.format((Double)v1 + 1.4)), valueOps.increment(key, 1.4)); assertEquals(Double.valueOf(twoDForm.format((Double)v1 + 1.4)), valueOps.get(key)); valueOps.increment(key, -10d);