diff --git a/src/main/java/io/lettuce/core/RedisURI.java b/src/main/java/io/lettuce/core/RedisURI.java index 0e4ce55241..cf6328dbeb 100644 --- a/src/main/java/io/lettuce/core/RedisURI.java +++ b/src/main/java/io/lettuce/core/RedisURI.java @@ -15,8 +15,7 @@ */ package io.lettuce.core; -import static io.lettuce.core.internal.LettuceStrings.isEmpty; -import static io.lettuce.core.internal.LettuceStrings.isNotEmpty; +import static io.lettuce.core.internal.LettuceStrings.*; import java.io.Serializable; import java.io.UnsupportedEncodingException; @@ -24,7 +23,14 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import java.util.function.LongFunction; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -128,6 +134,7 @@ * * @author Mark Paluch * @author Guy Korland + * @author Johnny Lim * @since 3.0 */ @SuppressWarnings("serial") diff --git a/src/test/java/io/lettuce/core/RedisURIUnitTests.java b/src/test/java/io/lettuce/core/RedisURIUnitTests.java index 1fec2811aa..bc785cc6ea 100644 --- a/src/test/java/io/lettuce/core/RedisURIUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisURIUnitTests.java @@ -15,8 +15,7 @@ */ package io.lettuce.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.*; import java.time.Duration; import java.util.LinkedHashMap; @@ -202,8 +201,10 @@ void timeoutParsingTest() { RedisURI defaultUri = new RedisURI(); checkUriTimeout("redis://auth@localhost:1234/5?timeout=junk", defaultUri.getTimeout().getSeconds(), TimeUnit.SECONDS); - RedisURI redisURI = RedisURI.create("redis://auth@localhost:1234/5?timeout=5000ms"); - assertThat(redisURI).hasToString("redis://****@localhost:1234/5?timeout=5s"); + assertThat(RedisURI.create("redis://auth@localhost:1234/5?timeout=5000ms")) + .hasToString("redis://****@localhost:1234/5?timeout=5s"); + assertThat(RedisURI.create("redis://auth@localhost:1234/5?timeout=123ms")) + .hasToString("redis://****@localhost:1234/5?timeout=123000000ns"); } @Test