dsmiley commented on code in PR #3442:
URL: https://github.com/apache/solr/pull/3442#discussion_r2234049122


##########
solr/solrj/src/test/org/apache/solr/client/solrj/util/ClientUtilsTest.java:
##########


Review Comment:
   Dunno why you added tests here; you already added another, better (IMO) 
class for tests



##########
solr/solrj/src/test/org/apache/solr/client/solrj/request/QueryRequestQtTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj.request;
+
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.SolrParams;
+import org.junit.Test;
+
+public class QueryRequestQtTest extends SolrTestCase {

Review Comment:
   I'd remove "Qt" param from the name so that it may be used to test other 
things



##########
solr/solrj/src/test/org/apache/solr/client/solrj/util/ClientUtilsTest.java:
##########
@@ -79,4 +82,31 @@ public void testUrlBuilding() throws Exception {
       assertEquals("http://localhost:8983/solr/admin/info/health";, url);
     }
   }
+
+  @Test
+  public void testQueryRequestQtParameterRemoval() {
+    SolrQuery query = new SolrQuery("*:*");
+    query.setRequestHandler("/custom");
+
+    QueryRequest request = new QueryRequest(query);
+
+    assertEquals("/custom", request.getPath());
+
+    SolrParams params = request.getParams();
+    assertNull("qt parameter should be removed from request params", 
params.get(CommonParams.QT));
+    assertEquals("*:*", params.get(CommonParams.Q));
+  }
+
+  @Test
+  public void testQueryRequestQtParameterWithoutSlash() {
+    SolrQuery query = new SolrQuery("*:*");
+    query.setRequestHandler("custom"); // no leading slash
+
+    QueryRequest request = new QueryRequest(query);
+
+    assertEquals("/select", request.getPath());
+
+    SolrParams params = request.getParams();
+    assertNull("qt parameter should be removed from request params", 
params.get(CommonParams.QT));

Review Comment:
   if there's no leading slash; shouldn't it be sent to the server in case 
handleSelect=true?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to