Class LLMAssistedCodemodTest

java.lang.Object
io.codemodder.testutils.llm.LLMAssistedCodemodTest

public abstract class LLMAssistedCodemodTest extends Object
An LLMAssistedCodemodTest tests each file with extension .java.before in the Metadata.testResourceDir() test resource directory (including subdirectories) by executing the Metadata.codemodType() LLM-assisted codemod and verifying the changes.

If a file being tested is not paired with a .java.after file, the test will verify that the LLM-assisted codemod does not change the file.

If the CODEMODDER_OPENAI_API_KEY environment variable is not set, the tests will be disabled.

  • Constructor Details

    • LLMAssistedCodemodTest

      public LLMAssistedCodemodTest()
  • Method Details

    • getRequirementsPrompt

      protected abstract String getRequirementsPrompt()
      If a codemod's changes don't exactly match the .java.after file, the LLM will use these requirements to assess whether the changes are similar enough to pass the test.