Ma77Ball commented on code in PR #4919:
URL: https://github.com/apache/texera/pull/4919#discussion_r3185265779


##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/lineChart/LineChartOpDescSpec.scala:
##########
@@ -96,22 +96,22 @@ class LineChartOpDescSpec extends AnyFlatSpec with Matchers 
{
     code should not include "Y_LBL_SENT"
   }
 
-  it should "raise NullPointerException when lines is left at its null 
default" in {
-    // Pin: `var lines: util.List[LineConfig] = _` defaults to null, and
-    // `createPlotlyFigure` calls `lines.asScala.map(...)` without a null
-    // check. Calling `generatePythonCode` on a default-constructed LineChart
-    // therefore throws NPE rather than rendering an empty chart or raising
-    // an AssertionError. Documenting so a future fix that null-guards lines
-    // breaks this spec deliberately.
+  it should "raise AssertionError when lines is left at its default (empty 
list)" in {
+    // `var lines: util.List[LineConfig]` defaults to an empty ArrayList.
+    // `createPlotlyFigure` asserts nonEmpty on lines before iterating, so a
+    // default-constructed LineChartOpDesc raises AssertionError with a
+    // descriptive message rather than proceeding with no traces.
     val op = new LineChartOpDesc
-    assertThrows[NullPointerException](op.generatePythonCode())
+    val ex = intercept[AssertionError](op.generatePythonCode())
+    ex.getMessage should include("At least one line must be configured")
   }
 
-  it should "render code with an empty lines list (no NPE, no assertion)" in {
+  it should "raise AssertionError when lines is explicitly set to an empty 
list" in {
+    // `createPlotlyFigure` guards against an empty lines list with an 
assertion,
+    // matching the fail-fast pattern used by sibling visualizers
+    // (HeatMapOpDesc, BarChartOpDesc).
     val op = configured
     op.lines = new util.ArrayList[LineConfig]()

Review Comment:
   Added



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