Repository: influxdata/influxdb-java (java)

Issue:
Cannot use subquery with QueryBuilder because SubQuery.close() is package private?
Am I missing something or does this method need to be made public for QueryBuilder subqueries to be usable outside of the org.influxdb.querybuilder package? Trying to imitate the examples here: https://github.com/influxdata/influxdb-java/blob/master/src/test/java/org/influxdb/querybuilder/SelectionSubQueryImplTest.java#L65 but cant without access to that method.

Pull request:
Fixes #647. make SubQuery#close public
Also moved query builder api tests to sub package to catch access issues.

Patch:
diff --git a/src/main/java/org/influxdb/querybuilder/SubQuery.java b/src/main/java/org/influxdb/querybuilder/SubQuery.java
index ee62c31..5f59b6e 100644
--- a/src/main/java/org/influxdb/querybuilder/SubQuery.java
+++ b/src/main/java/org/influxdb/querybuilder/SubQuery.java
@@ -12,7 +12,7 @@ public abstract class SubQuery<T extends WithSubquery> implements QueryStringBui
     return parent;
   }
 
-  T close() {
+  public T close() {
     parent.setSubQuery(this);
     return parent;
   }


Test patch:
diff --git a/src/test/java/org/influxdb/querybuilder/AppenderTest.java b/src/test/java/org/influxdb/querybuilder/api/AppenderTest.java
similarity index 87%
rename from src/test/java/org/influxdb/querybuilder/AppenderTest.java
rename to src/test/java/org/influxdb/querybuilder/api/AppenderTest.java
index e86041d..c922a77 100644
--- a/src/test/java/org/influxdb/querybuilder/AppenderTest.java
+++ b/src/test/java/org/influxdb/querybuilder/api/AppenderTest.java
@@ -1,9 +1,11 @@
-package org.influxdb.querybuilder;
+package org.influxdb.querybuilder.api;
 
 import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.Collections;
+
+import org.influxdb.querybuilder.Appender;
 import org.junit.jupiter.api.Test;
 
 public class AppenderTest {
diff --git a/src/test/java/org/influxdb/querybuilder/BuiltQueryTest.java b/src/test/java/org/influxdb/querybuilder/api/BuiltQueryTest.java
similarity index 99%
rename from src/test/java/org/influxdb/querybuilder/BuiltQueryTest.java
rename to src/test/java/org/influxdb/querybuilder/api/BuiltQueryTest.java
index 8acbacf..2f9565a 100644
--- a/src/test/java/org/influxdb/querybuilder/BuiltQueryTest.java
+++ b/src/test/java/org/influxdb/querybuilder/api/BuiltQueryTest.java
@@ -1,4 +1,4 @@
-package org.influxdb.querybuilder;
+package org.influxdb.querybuilder.api;
 
 import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.*;
 import static org.influxdb.querybuilder.Operations.ADD;
@@ -10,6 +10,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.influxdb.dto.Query;
+import org.influxdb.querybuilder.RawText;
+import org.influxdb.querybuilder.Where;
 import org.junit.jupiter.api.Test;
 
 public class BuiltQueryTest {
diff --git a/src/test/java/org/influxdb/querybuilder/SelectionSubQueryImplTest.java b/src/test/java/org/influxdb/querybuilder/api/SelectionSubQueryImplTest.java
similarity index 99%
rename from src/test/java/org/influxdb/querybuilder/SelectionSubQueryImplTest.java
rename to src/test/java/org/influxdb/querybuilder/api/SelectionSubQueryImplTest.java
index f2574a9..23e27c2 100644
--- a/src/test/java/org/influxdb/querybuilder/SelectionSubQueryImplTest.java
+++ b/src/test/java/org/influxdb/querybuilder/api/SelectionSubQueryImplTest.java
@@ -1,4 +1,4 @@
-package org.influxdb.querybuilder;
+package org.influxdb.querybuilder.api;
 
 import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.*;
 import static org.influxdb.querybuilder.Operations.ADD;