From b5497f0a43019f2a869c571de69a8a9aab86eae1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Sun, 27 Sep 2015 09:59:15 +0200 Subject: [PATCH] Use GeoArgs parameter in georadiusbymember method #142 --- src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java | 5 ++--- src/test/java/com/lambdaworks/redis/GeoCommandTest.java | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java b/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java index 9b669feed8..82f000eb0d 100644 --- a/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java +++ b/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java @@ -1749,7 +1749,6 @@ public Command>> georadius(K key, double longitude, doub assertNotNull(geoArgs, "geoArgs must not be null"); CommandArgs args = new CommandArgs(codec).addKey(key).add(longitude).add(latitude).add(distance).add(unit); - geoArgs.build(args); return createCommand(GEORADIUS, new GeoWithinListOutput(codec, geoArgs.isWithDistance(), geoArgs.isWithHash(), @@ -1762,8 +1761,9 @@ public Command> georadiusbymember(K key, V member, double distance, } public Command>> georadiusbymember(K key, V member, double distance, String unit, GeoArgs geoArgs) { - CommandArgs args = new CommandArgs(codec).addKey(key).addValue(member).add(distance).add(unit); assertNotNull(geoArgs, "geoArgs must not be null"); + CommandArgs args = new CommandArgs(codec).addKey(key).addValue(member).add(distance).add(unit); + geoArgs.build(args); return createCommand( GEORADIUSBYMEMBER, @@ -1786,7 +1786,6 @@ public Command geodist(K key, V from, V to, GeoArgs.Unit unit) { } return createCommand(GEODIST, new DoubleOutput(codec), args); - } /** diff --git a/src/test/java/com/lambdaworks/redis/GeoCommandTest.java b/src/test/java/com/lambdaworks/redis/GeoCommandTest.java index e8d56c91c1..b9553af537 100644 --- a/src/test/java/com/lambdaworks/redis/GeoCommandTest.java +++ b/src/test/java/com/lambdaworks/redis/GeoCommandTest.java @@ -143,6 +143,8 @@ public void georadiusbymemberWithArgs() throws Exception { GeoWithin weinheim = georadiusbymember.get(0); assertThat(weinheim.member).isEqualTo("Weinheim"); + assertThat(weinheim.distance).isNotNull(); + assertThat(weinheim.coordinates).isNotNull(); } @Test(expected = IllegalArgumentException.class)