Class ModuleAnalyzer
- java.lang.Object
-
- nl.zerofiftyit.mdepunit.core.validation.DefaultAnalyzerImpl
-
- nl.zerofiftyit.mdepunit.core.validation.ModuleAnalyzer
-
- All Implemented Interfaces:
DefaultAnalyzer
public final class ModuleAnalyzer extends DefaultAnalyzerImpl
-
-
Constructor Summary
Constructors Constructor Description ModuleAnalyzer(String givenNode, List<PomElement> pomElements, ResultCaller resultCaller, NegateNext negateNext, List<String> errorMessages)Constructs a new instance ofModuleAnalyzerwith the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Statement<ModuleAnalyzer>containModuleNode(@NonNull String moduleName)Checks if the specified module node exists within the analyzed POM elements.Statement<ModuleAnalyzer>moduleExists(@NonNull String moduleName)Validates if a module with the given name exists and contains a `pom.xml` file.-
Methods inherited from class nl.zerofiftyit.mdepunit.core.validation.DefaultAnalyzerImpl
containValue, equalsValue, getPomElements, haveTag
-
-
-
-
Constructor Detail
-
ModuleAnalyzer
public ModuleAnalyzer(String givenNode, List<PomElement> pomElements, ResultCaller resultCaller, NegateNext negateNext, List<String> errorMessages)
Constructs a new instance ofModuleAnalyzerwith 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 analyzerpomElements- a list ofPomElementinstances representing elements in a POM fileresultCaller- an instance ofResultCallerfor managing and validating errorsnegateNext- an instance ofNegateNextspecifying if the next operation should negate its behaviorerrorMessages- 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 theResultCallerfor 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 theModuleAnalyzerclass.
-
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 theModuleAnalyzerclass.
-
-