Class PomAnalyzer

    • Constructor Detail

      • PomAnalyzer

        public PomAnalyzer​(String givenNode,
                           List<PomElement> pomElements,
                           ResultCaller resultCaller,
                           NegateNext negateNext,
                           List<String> errorMessages)
        Constructs a new instance of the PomAnalyzer class, which extends the functionality of DefaultAnalyzer with additional convenience methods for analyzing and validating.
        Parameters:
        givenNode - the initial node within the POM structure where analysis should begin
        pomElements - a set of PomElement objects representing POM nodes for analysis
        resultCaller - a ResultCaller instance used for validation and error management
        negateNext - a NegateNext utility class controlling conditional negation logic
        errorMessages - a set of error messages for recording validation errors during analysis
    • Method Detail

      • haveProperty

        public Statement<PomAnalyzer> haveProperty​(String propertyName)
        Checks whether the Maven POM contains a specific property. Depending on the current state of `should` or `shouldNot`, it determines if the property is expected to exist or not and records an error message if the condition is violated.

        Example usage: XML: &lt;properties&gt; &lt;java.version&gt;11&lt;/java.version&gt; &lt;/properties&gt; Java: should().haveProperty("java.version")

        Parameters:
        propertyName - the name of the property to check for in the POM.
        Returns:
        the current instance of ResultCaller, allowing further method chaining.