acsbendi commented on code in PR #1054:
URL: https://github.com/apache/solr/pull/1054#discussion_r998272943
##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MovingAverageEvaluatorTest.java:
##########
@@ -0,0 +1,40 @@
+package org.apache.solr.client.solrj.io.stream.eval;
Review Comment:
Fixed
##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MovingAverageEvaluatorTest.java:
##########
@@ -0,0 +1,40 @@
+package org.apache.solr.client.solrj.io.stream.eval;
+
+import junit.framework.Assert;
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.io.Tuple;
+import org.apache.solr.client.solrj.io.eval.MovingAverageEvaluator;
+import org.apache.solr.client.solrj.io.eval.StreamEvaluator;
+import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MovingAverageEvaluatorTest extends SolrTestCase {
+
+ StreamFactory factory;
+ Map<String, Object> values;
+
+ public MovingAverageEvaluatorTest() {
+ super();
+
+ factory =
+ new StreamFactory()
+ .withFunctionName("movingAvg",
MovingAverageEvaluator.class);
+ values = new HashMap<>();
+ }
+
+ @Test
+ public void doesNotFailWithEmptyList() throws Exception {
+ StreamEvaluator evaluator =
factory.constructEvaluator("movingAvg(a,30)");
+ Object result;
+
+ values.clear();
+ values.put("a", new ArrayList<Double>());
+ result = evaluator.evaluate(new Tuple(values));
+ Assert.assertEquals(Collections.emptyList(), result);
Review Comment:
Fixed
--
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]