Skip to content

Commit

Permalink
TairGis: fix gissearch result factory npe
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbodong22011 committed Nov 25, 2022
1 parent 3e85818 commit f621593
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Map<String, String> build(Object data) {
List<byte[]> rawResults;
List<Object> result = (List<Object>) data;
if (null == result || 0 == result.size()) {
rawResults = null;
return new HashMap<>();
} else {
rawResults = (List) result.get(1);
}
Expand All @@ -45,7 +45,7 @@ public Map<byte[], byte[]> build(Object data) {
List<byte[]> rawResults;
List<Object> result = (List<Object>) data;
if (null == result || 0 == result.size()) {
rawResults = null;
return new HashMap<>();
} else {
rawResults = (List) result.get(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ public void gissearchTest() throws Exception {
AssertUtil.assertEquals(1, Map.class.cast(objs.get(i)).size());
}

@Test
public void gissearchNotExistsTest() throws Exception {
String polygonWktText = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))", pointWktText = "POINT (30 11)";
// String
tairGisPipeline.gissearch(area, pointWktText);
List<Object> objs = tairGisPipeline.syncAndReturnAll();
Assert.assertEquals(1, objs.size());
Assert.assertEquals(0, Map.class.cast(objs.get(0)).size());
}

@Test
public void gisdelTest() throws Exception {
String uuid = UUID.randomUUID().toString();
Expand Down

0 comments on commit f621593

Please sign in to comment.