Class PlaceholderMatcher

java.lang.Object
org.ek9lang.cli.PlaceholderMatcher

final class PlaceholderMatcher extends Object
Matches expected output containing {{Type}} placeholders against actual output. Placeholders use EK9 type names - if you know EK9 types, you know the placeholders.

Supports 18 placeholder types corresponding to EK9 built-in types:

  • Basic: String, Integer, Float, Boolean, Character, Bits
  • Date/Time: Date, Time, DateTime, Duration, Millisecond
  • Measurement: Money, Colour, Resolution, Dimension
  • Pattern: RegEx, GUID
  • File system: FileSystemPath

Example usage in expected_output.txt:

Completed in: {{Millisecond}}
Timestamp: {{DateTime}}
Cost: {{Money}}
  • Constructor Details

    • PlaceholderMatcher

      PlaceholderMatcher()
  • Method Details

    • hasPlaceholders

      boolean hasPlaceholders(String expected)
      Check if expected output contains any placeholders.
      Parameters:
      expected - The expected output template
      Returns:
      true if at least one {{Type}} placeholder is present
    • matches

      boolean matches(String expected, String actual)
      Match expected output (with placeholders) against actual output.
      Parameters:
      expected - The expected output template containing {{Type}} placeholders
      actual - The actual output from test execution
      Returns:
      true if actual output matches the expected template
    • validatePlaceholders

      List<String> validatePlaceholders(String expected)
      Validate that all placeholders in expected output are valid EK9 types.
      Parameters:
      expected - The expected output template
      Returns:
      List of invalid placeholder names (empty if all valid)
    • getSupportedPlaceholders

      List<String> getSupportedPlaceholders()
      Get list of all supported placeholder type names.
      Returns:
      Unmodifiable list of valid placeholder names