From af11700962c04bb9c49bea3e32b1ac40e653680f 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 ++--- .../java/com/lambdaworks/redis/commands/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 64bf4f3273..1166b3d8f6 100644 --- a/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java +++ b/src/main/java/com/lambdaworks/redis/RedisCommandBuilder.java @@ -1791,7 +1791,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(), @@ -1804,8 +1803,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, @@ -1828,7 +1828,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/commands/GeoCommandTest.java b/src/test/java/com/lambdaworks/redis/commands/GeoCommandTest.java index 04bb635d3e..989263a8fc 100644 --- a/src/test/java/com/lambdaworks/redis/commands/GeoCommandTest.java +++ b/src/test/java/com/lambdaworks/redis/commands/GeoCommandTest.java @@ -145,6 +145,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)