Class TestSourceCleaner

java.lang.Object
com.vaadin.copilot.plugins.testgeneration.TestSourceCleaner

public final class TestSourceCleaner extends Object
Trims the view source and the rendered DOM before they are sent to the Copilot server for test generation, so the prompt carries only what matters.
  • Method Details

    • cleanJavaCode

      public static String cleanJavaCode(String sourceCode)
      Strips comments and superfluous whitespace from Java source.
      Parameters:
      sourceCode - the source to clean
      Returns:
      the cleaned source, or the input unchanged if it cannot be parsed
    • cleanHtml

      public static String cleanHtml(String html)
      Removes dev-tools markup, presentational attributes and generated ids from the rendered DOM.
      Parameters:
      html - the outer HTML of the view
      Returns:
      the cleaned, whitespace-collapsed HTML