Class ModuleAnalyzer

    • Constructor Detail

      • ModuleAnalyzer

        public ModuleAnalyzer​(String givenNode,
                              List<PomElement> pomElements,
                              ResultCaller resultCaller,
                              NegateNext negateNext,
                              List<String> errorMessages)
        Constructs a new instance of ModuleAnalyzer with the specified parameters. This class is responsible for analyzing modules and their associated POM elements, validating their existence and structure, and collecting error messages if any issues are detected during the analysis process.
        Parameters:
        givenNode - the identifier or context node for this analyzer
        pomElements - a list of PomElement instances representing elements in a POM file
        resultCaller - an instance of ResultCaller for managing and validating errors
        negateNext - an instance of NegateNext specifying if the next operation should negate its behavior
        errorMessages - a list to accumulate error messages during the analysis
    • Method Detail

      • moduleExists

        public Statement<ModuleAnalyzer> moduleExists​(@NonNull
                                                      @NonNull String moduleName)
        Validates if a module with the given name exists and contains a `pom.xml` file. Adds an error message if the module is not a directory or does not include the `pom.xml` file. Uses the ResultCaller for error validation after the check. For example,
         <modules>
             <module>my-module</module>
         </modules>
         
        could be verified as follows:
         
         pomAnalyzer()
           .checkingModules()
           .should()
           .containValue("my-module")
           .and()
           .moduleExists("my-module")
           .validate();
         
         
        Parameters:
        moduleName - the name of the module to check for existence and validity.
        Returns:
        a Statement<ModuleAnalyzer> instance for further method chaining.
      • allRegisteredModulesExist

        public Statement<ModuleAnalyzer> allRegisteredModulesExist()
        Validates the existence of all registered modules listed in the POM elements and checks if they are properly structured with a `pom.xml` file.
        Returns:
        a Statement<ModuleAnalyzer> instance allowing for further method chaining within the ModuleAnalyzer class.
      • containModuleNode

        public Statement<ModuleAnalyzer> containModuleNode​(@NonNull
                                                           @NonNull String moduleName)
        Checks if the specified module node exists within the analyzed POM elements.
        Parameters:
        moduleName - the name of the module to check for existence within the module nodes.
        Returns:
        a Statement<ModuleAnalyzer> instance, enabling further method chaining within the ModuleAnalyzer class.