Package org.openrewrite.maven
Class Assertions
java.lang.Object
org.openrewrite.maven.Assertions
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.openrewrite.test.SourceSpecsstatic org.openrewrite.test.SourceSpecsstatic org.openrewrite.test.SourceSpecspomXml(@Nullable String before, @Nullable String after, Consumer<org.openrewrite.test.SourceSpec<org.openrewrite.xml.tree.Xml.Document>> spec) static org.openrewrite.test.SourceSpecspomXml(@Nullable String before, Consumer<org.openrewrite.test.SourceSpec<org.openrewrite.xml.tree.Xml.Document>> spec) static voidwithLocalRepository(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.static voidwithLocalRepository(String pomXml, Runnable testCode) Convenience overload that accepts a single POM.static voidwithLocalRepository(String pomXml1, String pomXml2, Runnable testCode) Convenience overload that accepts two POMs.
-
Method Details
-
pomXml
-
pomXml
-
pomXml
-
pomXml
-
withLocalRepository
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 elementstestCode- 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
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:
-