Class EmptyTestDetector

java.lang.Object
org.ek9lang.compiler.phase5.callgraph.EmptyTestDetector

public final class EmptyTestDetector extends Object
Detects @Test programs that have no validation - neither assertions nor expected output files.

E81007: Empty @Test program (no assertions and no expected output files)

A @Test is considered valid if it has EITHER:

  • Assertions reachable in its transitive call graph
  • Expected output files (expected_output.txt or expected_case_*.txt)

Tests with neither validation mechanism provide false confidence and are flagged as errors.

  • Constructor Details

    • EmptyTestDetector

      public EmptyTestDetector(CallGraph callGraph, CallableErrorListenerLookup errorListenerLookup)
      Create a detector for empty @Test programs.
      Parameters:
      callGraph - The call graph with test entry points and assertion information
      errorListenerLookup - Function to get ErrorListener for emitting errors
  • Method Details

    • detectAndReport

      public List<String> detectAndReport()
      Detect all empty @Test programs and emit E81007 errors.
      Returns:
      List of @Test program names that are empty (for reporting/testing)
    • detect

      public void detect(Consumer<CallableInfo> consumer)
      Alternative API for just detection without error emission. Useful for testing and analysis.
      Parameters:
      consumer - Callback for each empty test found