ganesh-skumar commented on code in PR #41615:
URL: https://github.com/apache/beam/pull/41615#discussion_r4754877878


##########
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/BatchElementsTest.java:
##########
@@ -104,6 +106,35 @@ public void 
testBatchConfigNegativeFixedCostDurationThrows() {
     
BatchElements.BatchConfig.builder().withTargetBatchDurationSecsWithFixedCost(-5.0).build();
   }
 
+  // Element sizing & max batch weight validation
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testMaxBatchWeightZeroThrows() {
+    
BatchElements.<String>withDefaults().withElementSizeFn(String::length).withMaxBatchWeight(0);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testMaxBatchWeightNegativeThrows() {
+    
BatchElements.<String>withDefaults().withElementSizeFn(String::length).withMaxBatchWeight(-10);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testNullConfigThrows() {
+    BatchElements.<String>withConfig(null);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testNullElementSizeFnThrows() {
+    BatchElements.<String>withDefaults().withElementSizeFn(null);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testMaxBatchWeightRequiresElementSizeFn() {

Review Comment:
   Updated test case. 



-- 
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]

Reply via email to