gsmiller commented on code in PR #1013:
URL: https://github.com/apache/lucene/pull/1013#discussion_r918423465


##########
lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java:
##########
@@ -264,4 +264,24 @@ protected void assertFloatValuesEquals(FacetResult a, 
FacetResult b) {
           a.labelValues[i].value.floatValue() / 1e5);
     }
   }
+
+  protected void assertNumericValuesEquals(Number a, Number b) {
+    assertTrue(a.getClass().isInstance(b));
+    if (a instanceof Float) {
+      assertEquals(a.floatValue(), b.floatValue(), a.floatValue() / 1e5);
+    } else if (a instanceof Double) {
+      assertEquals(a.doubleValue(), b.doubleValue(), a.doubleValue() / 1e5);
+    } else {
+      assertEquals(a, b);
+    }
+  }
+
+  protected void assertAllChildrenEqualsWithoutOrdering(FacetResult a, 
FacetResult b) {

Review Comment:
   The naming of this method leads me to believe it's only going to validate 
the children, but it's checking dims, paths, etc. I wonder if we shouldn't name 
it something more generic?
   
   Also, it feels a little weird to me that callers have to create a 
`FacetResult` for their expected data to use this method. I wonder if it would 
be easier to have a signature like this:
   
   ```
     protected void assertFacetResult(String expectedDim,
                                      String[] expectedPath,
                                      int expectedChildCount,
                                      Number expectedValue,
                                      LabelAndValue... expectedChildren)
   ```



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to