Package pl.tfij.test.modulesize
Class ProjectSummary
java.lang.Object
pl.tfij.test.modulesize.ProjectSummary
The ProjectSummary class provides methods for analyzing and summarizing project modules.
It allows to verify module sizes, generate Mermaid pie charts, save charts to files, and retrieve module summaries.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionGenerates a Mermaid pie chart representation based on analyzed modules.intGenerates a summary of the analyzed modules.intsaveMermaidPieChart(Path target) Saves the Mermaid pie chart representation of the project summary to the specified target path.verifyEachModuleRelativeSizeIsSmallerThan(double threshold) Verifies that the relative size of each moduleName is smaller than the given threshold.verifyModuleRelativeSizeIsSmallerThan(String module, double threshold) Verifies that the relative size of the specified moduleName is smaller than the given threshold.Verifies whether none of the defined modules is empty.verifyUndefinedModuleNumberOfFilesIsSmallerThan(int allowedFileCount) Verifies that the number of files in the undefined moduleName is smaller than the specified allowedFileCount.
-
Method Details
-
verifyNoEmptyModules
Verifies whether none of the defined modules is empty.- Returns:
- The ProjectSummary instance to allow method chaining.
- Throws:
AssertionError- When any of the modules is empty.
-
verifyEachModuleRelativeSizeIsSmallerThan
Verifies that the relative size of each moduleName is smaller than the given threshold.- Parameters:
threshold- The maximum relative size allowed for each moduleName. Must be a positive number in the range (0, 1].- Returns:
- The ProjectSummary instance to allow method chaining.
- Throws:
IllegalArgumentException- if the threshold is not within the valid range.AssertionError- if any moduleName's relative size exceeds the threshold.
-
verifyModuleRelativeSizeIsSmallerThan
Verifies that the relative size of the specified moduleName is smaller than the given threshold.- Parameters:
module- The name of the moduleName to verify.threshold- The maximum relative size allowed for the moduleName.- Returns:
- The ProjectSummary instance to allow method chaining.
- Throws:
IllegalArgumentException- if the specified moduleName is not defined.IllegalArgumentException- if the threshold is not within the valid range.AssertionError- if the relative size of the moduleName exceeds the threshold.
-
verifyUndefinedModuleNumberOfFilesIsSmallerThan
Verifies that the number of files in the undefined moduleName is smaller than the specified allowedFileCount.- Parameters:
allowedFileCount- The maximum number of files allowed in the undefined moduleName. Value must be positive or zero int number.- Returns:
- The ProjectSummary instance to allow method chaining.
- Throws:
IllegalArgumentException- if the given allowedFileCount has invalid value.AssertionError- if the number of files in the undefined moduleName exceeds the allowedFileCount.
-
createMermaidPieChart
Generates a Mermaid pie chart representation based on analyzed modules.- Returns:
- A string representing the Mermaid pie chart.
-
saveMermaidPieChart
Saves the Mermaid pie chart representation of the project summary to the specified target path.- Parameters:
target- the path where the Mermaid pie chart will be saved.- Returns:
- The ProjectSummary instance to allow method chaining.
- Throws:
ModuleSizeCalculatorException- if an I/O error occurs while saving the Mermaid chartIllegalArgumentException- if the target path is null
-
modulesSummary
Generates a summary of the analyzed modules.- Returns:
- A list containing ModuleSummary objects representing each analyzed moduleName.
-
numberOfFiles
public int numberOfFiles()- Returns:
- total number of files in the project.
-
linesOfCode
public int linesOfCode()- Returns:
- total number of lines of code in the project.
-