Class Assertions

java.lang.Object
org.openrewrite.maven.Assertions

public class Assertions extends Object
  • Method Details

    • pomXml

      public static org.openrewrite.test.SourceSpecs pomXml(@Language("xml") @Nullable String before)
    • pomXml

      public static org.openrewrite.test.SourceSpecs pomXml(@Language("xml") @Nullable String before, Consumer<org.openrewrite.test.SourceSpec<org.openrewrite.xml.tree.Xml.Document>> spec)
    • pomXml

      public static org.openrewrite.test.SourceSpecs pomXml(@Language("xml") @Nullable String before, @Language("xml") @Nullable String after)
    • pomXml

      public static org.openrewrite.test.SourceSpecs pomXml(@Language("xml") @Nullable String before, @Language("xml") @Nullable String after, Consumer<org.openrewrite.test.SourceSpec<org.openrewrite.xml.tree.Xml.Document>> spec)
    • withLocalRepository

      public static void withLocalRepository(@Language("xml") String[] pomXmls, Runnable testCode)
      Publishes test POMs to the local Maven repository for use as parents or dependencies in tests, executes the provided test code, then cleans up the published POMs. This ensures the POMs are resolved as external dependencies rather than being parsed as part of the project. WARNING: To avoid overwriting real POMs in your local repository, only use this method with invented/test GAV coordinates. Avoid real coordinates like org.springframework.boot:spring-boot-starter-parent.
      Parameters:
      pomXmls - The POM XML content strings, each containing groupId, artifactId, and version elements
      testCode - The test code to execute after publishing the POMs
      Throws:
      IllegalArgumentException - if any POM XML doesn't contain required GAV coordinates or uses a well-known groupId
    • withLocalRepository

      public static void withLocalRepository(@Language("xml") String pomXml, Runnable testCode)
      Convenience overload that accepts a single POM.
      See Also:
    • withLocalRepository

      public static void withLocalRepository(@Language("xml") String pomXml1, @Language("xml") String pomXml2, Runnable testCode)
      Convenience overload that accepts two POMs.
      See Also: