Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8eca48b
Adding basic Testing functionality
AndreasIgel Aug 17, 2025
a2537e0
fix(processor): box primitive type arguments in generics; add null-ch…
AndreasIgel Aug 17, 2025
2ef34b5
test(processor): support Java text blocks in test sources via Process…
AndreasIgel Aug 17, 2025
eb08fca
Refactoring tests for improving readability
AndreasIgel Aug 17, 2025
a95fdc0
Adding edge-cases in tests
AndreasIgel Aug 17, 2025
d4cace7
Improving tests by extra helper asserts
AndreasIgel Aug 17, 2025
6fd8e15
Merge AbstractBuilderProcessorTest into BuilderProcessorTest to simpl…
AndreasIgel Aug 18, 2025
9e220ca
Adding coverage tracking to project
AndreasIgel Aug 18, 2025
ee34331
Excluding mappers and dtos from coverage
AndreasIgel Aug 18, 2025
ae45642
Fixing tests and enable them
AndreasIgel Aug 18, 2025
ef17113
Adding codecoverage icon on readme
AndreasIgel Aug 18, 2025
96d55e6
Adding further tests of paths
AndreasIgel Aug 18, 2025
ed6254c
Adding further tests for coverage
AndreasIgel Aug 18, 2025
f99c5f8
Improving tests and adding a test for examples from Readme
AndreasIgel Aug 18, 2025
ecea939
Adding status in DTO and Buildertest
AndreasIgel Aug 18, 2025
cc82dee
Extending further asserts for Map
AndreasIgel Aug 18, 2025
af69380
Extending TypeNameGeneric to support multiple generics
AndreasIgel Aug 18, 2025
76e94b2
Improving checks in existing code
AndreasIgel Aug 18, 2025
2cd3961
Fixing code of new extended TypeNameGeneric
AndreasIgel Aug 18, 2025
2b0fd76
Imporving code for handling list of type parameters
AndreasIgel Aug 18, 2025
8a8df6a
adding further tests for edge cases
AndreasIgel Aug 18, 2025
58e9f7b
Adding test for record and for multiple parameter constructor
AndreasIgel Aug 19, 2025
5ef6547
Disabling Record-Test because it is not supported yet
AndreasIgel Aug 19, 2025
04e81aa
Constructor Parameters are not supported yet
AndreasIgel Aug 19, 2025
7ac4225
Adding check for Java-17 minimal
AndreasIgel Aug 19, 2025
64e6844
Updating codecov settings for github-actions
AndreasIgel Aug 19, 2025
4605d41
Refactoring maven-versions in pom.xmls
AndreasIgel Aug 19, 2025
c1fa023
Adding test for wrong java-version
AndreasIgel Aug 19, 2025
57bd08b
Adding tests for annotation on interfaces or abstract classes
AndreasIgel Aug 19, 2025
c43ea65
Adding codecov.yml for specific coverage reports in pull-requests
AndreasIgel Aug 19, 2025
ae8e45a
Merge branch 'main' into feature/adding-unit-tests
AndreasIgel Aug 31, 2025
168797f
Updating Tests for further todos
AndreasIgel Aug 31, 2025
4a9ec0b
Refactoring usage of assertNotContaining
AndreasIgel Aug 31, 2025
9a6c38f
Fixing tests
AndreasIgel Aug 31, 2025
8fb51d9
Replacing assertingResult by assertContaining
AndreasIgel Aug 31, 2025
024f3e3
Refactoring usage of assertingResult in cases of asserts of contain m…
AndreasIgel Aug 31, 2025
db7d601
Refactoring tests (removing unneeded tests and extending asserts)
AndreasIgel Aug 31, 2025
cbf7839
Updating format of full-string and replacing string-concatenation
AndreasIgel Aug 31, 2025
e2523f9
Adding a helper function for additional source files
AndreasIgel Aug 31, 2025
188c3d8
Solving todos in tests
AndreasIgel Aug 31, 2025
d143567
Fixing position of test shouldHandleListOfCustomTypeWithoutEmptyConst…
AndreasIgel Aug 31, 2025
4dbfeaf
Fixing codeformat
AndreasIgel Aug 31, 2025
c3a0189
Adding further tests (even for features, which are not working yet)
AndreasIgel Aug 31, 2025
a4815a6
Removing unwanted change in Readme
AndreasIgel Aug 31, 2025
fd67749
Fixing findings in test
AndreasIgel Aug 31, 2025
abc9c6d
Adding test for other cases of generics
AndreasIgel Aug 31, 2025
04587eb
Adding workflow step for publishing testresults to codecov
AndreasIgel Sep 1, 2025
7f9c69e
Optimization of pipeline, coverage is now calculated on metrics-profi…
AndreasIgel Sep 1, 2025
e5bbae0
Having no nested classes for Builders
AndreasIgel Sep 1, 2025
c69d6f1
Fixing handling of functional interfaces (no consumer or supplier sho…
AndreasIgel Sep 2, 2025
f1e4bf1
Taking javadoc of parameter over into builder javadoc
AndreasIgel Sep 2, 2025
a7370d5
Supporting generic types in DTOs
AndreasIgel Sep 4, 2025
1c66fa7
Switching to use interfaces instead of implementation of lists in Bui…
AndreasIgel Sep 4, 2025
c5991ef
Fixing coding-style issues
AndreasIgel Sep 4, 2025
9260ff3
Added tests for javadoc extraction
AndreasIgel Sep 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
permissions:
contents: read
pull-requests: write
checks: write

steps:
- uses: actions/checkout@v4
Expand All @@ -31,7 +32,7 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B verify --file pom.xml
run: mvn -B verify -Pmetrics --file pom.xml

- name: Upload JaCoCo HTML report (processor)
if: always()
Expand All @@ -49,13 +50,25 @@ jobs:
path: processor/target/site/jacoco/jacoco.xml
if-no-files-found: warn

- name: Upload coverage to Codecov
- name: Upload test results to Codecov (processor)
if: always()
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
processor/target/surefire-reports/*.xml
processor/target/failsafe-reports/*.xml
if-no-files-found: warn
fail_ci_if_error: true
verbose: false

- name: Upload coverage to Codecov (processor)
if: always()
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: processor/target/site/jacoco/jacoco.xml
flags: processor
name: codecov-upload
verbose: true
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
92 changes: 50 additions & 42 deletions processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,48 +191,7 @@
</plugin>

<!-- JaCoCo Code Coverage (processor module only) -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${plugin.jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<!-- Exclude mapper utilities from coverage -->
<exclude>**/*Mapper*.class</exclude>
<!-- Exclude DTOs package from coverage -->
<exclude>**/processor/dtos/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
<configuration>
<!-- Only cover main sources of this module -->
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
<reports>
<report>html</report>
<report>xml</report>
<report>csv</report>
</reports>
<excludes>
<!-- exclude any generated sources or test utilities if they ever get packaged under main -->
<exclude>**/generated/**</exclude>
</excludes>
</configuration>
</plugin>
<!-- moved to 'coverage' profile -->
</plugins>
</build>

Expand Down Expand Up @@ -308,6 +267,55 @@
</plugins>
</build>
</profile>
<profile>
<id>metrics</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${plugin.jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<!-- Exclude mapper utilities from coverage -->
<exclude>**/*Mapper*.class</exclude>
<!-- Exclude DTOs package from coverage -->
<exclude>**/processor/dtos/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
<configuration>
<!-- Only cover main sources of this module -->
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
<reports>
<report>html</report>
<report>xml</report>
<report>csv</report>
</reports>
<excludes>
<!-- exclude any generated sources or test utilities if they ever get packaged under main -->
<exclude>**/generated/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package org.javahelpers.simple.builders.processor.dtos;

import java.util.LinkedList;
import java.util.List;

/** BuilderDefinitionDto holds all information for generating a builder. */
public class BuilderDefinitionDto {
Expand All @@ -34,17 +35,20 @@ public class BuilderDefinitionDto {
/** Type of builder. Containing package and name of DTO. */
private TypeName builderTypeName;

/** Generic parameters declared on the target DTO (e.g., <T extends Number, U>). */
private final List<GenericParameterDto> generics = new LinkedList<>();

/**
* List of all methods of target DTO which are supported by builder and not targeting a specific
* DTO field.
*/
private final LinkedList<MethodDto> methodsForBuilder = new LinkedList<>();
private final List<MethodDto> methodsForBuilder = new LinkedList<>();

/**
* List of all fields of target DTO which are supported by builder. A field could be supported by
* several functions in builder.
*/
private final LinkedList<FieldDto> setterFieldsForBuilder = new LinkedList<>();
private final List<FieldDto> setterFieldsForBuilder = new LinkedList<>();

/**
* Getting type of builder.
Expand Down Expand Up @@ -99,7 +103,7 @@ public void addMethod(MethodDto member) {
* @return list of methods with type {@code
* org.javahelpers.simple.builders.internal.dtos.MethodDto}
*/
public LinkedList<MethodDto> getMethodsForBuilder() {
public List<MethodDto> getMethodsForBuilder() {
return methodsForBuilder;
}

Expand All @@ -117,7 +121,17 @@ public void addField(FieldDto field) {
*
* @return list of fields with type {@code org.javahelpers.simple.builders.internal.dtos.FieldDto}
*/
public LinkedList<FieldDto> getSetterFieldsForBuilder() {
public List<FieldDto> getSetterFieldsForBuilder() {
return setterFieldsForBuilder;
}

/** Adds a generic parameter definition. */
public void addGeneric(GenericParameterDto generic) {
generics.add(generic);
}

/** Returns the list of generic parameters of the target DTO, in declared order. */
public List<GenericParameterDto> getGenerics() {
return generics;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public class FieldDto {
/** List of all methods in builder, which change the field. */
private final List<MethodDto> fieldSetterMethodsList = new ArrayList<>();

/** Optional Javadoc of the field extracted from setter or constructor. */
private String javaDoc;

/** Method-level generics declared on the setter, to be reused in builder methods. */
private final List<GenericParameterDto> fieldGenerics = new ArrayList<>();

/**
* Getting name of field.
*
Expand Down Expand Up @@ -95,4 +101,35 @@ public List<MethodDto> getMethods() {
public void addMethod(MethodDto methodDto) {
this.fieldSetterMethodsList.add(methodDto);
}

/**
* Getting extracted Javadoc.
*
* @return Javadoc text or null if none present
*/
public String getJavaDoc() {
return javaDoc;
}

/**
* Setting extracted Javadoc.
*
* @param javaDoc Javadoc text
*/
public void setJavaDoc(String javaDoc) {
this.javaDoc = javaDoc;
}

/** Returns generics declared on the setter (field-specific). */
public List<GenericParameterDto> getFieldGenerics() {
return fieldGenerics;
}

/** Replaces generics list with the provided entries. */
public void setFieldGenerics(List<GenericParameterDto> generics) {
this.fieldGenerics.clear();
if (generics != null) {
this.fieldGenerics.addAll(generics);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* MIT License
*
* Copyright (c) 2025 Andreas Igel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.javahelpers.simple.builders.processor.dtos;

import java.util.LinkedList;
import java.util.List;

/** Represents a generic type parameter (e.g., T extends Number & Comparable<T>). */
public class GenericParameterDto {
/** The name of the generic parameter (e.g., "T"). */
private String name;

/** Optional upper bounds in declared order (empty if unbounded). */
private final List<TypeName> upperBounds = new LinkedList<>();

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

/** Add an upper bound. */
public void addUpperBound(TypeName bound) {
if (bound != null) {
upperBounds.add(bound);
}
}

/** Returns all upper bounds (possibly empty). */
public List<TypeName> getUpperBounds() {
return upperBounds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.javahelpers.simple.builders.processor.dtos.MethodTypes.PROXY;

import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import javax.lang.model.element.Modifier;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -51,6 +52,9 @@ public class MethodDto {
/** Definition of inner implementation for method. */
private final MethodCodeDto methodCodeDto = new MethodCodeDto();

/** Method-level type parameters (e.g., <T extends Serializable>). */
private final List<GenericParameterDto> methodGenerics = new LinkedList<>();

/**
* Getting type of method for source code generation. Defaults to {@code
* org.javahelpers.simple.builders.internal.dtos.MethodTypes.PROXY}.
Expand Down Expand Up @@ -159,6 +163,19 @@ public LinkedList<MethodParameterDto> getParameters() {
return parameters;
}

/** Replaces method-level generic parameter list with the provided entries. */
public void setMethodGenerics(List<GenericParameterDto> generics) {
this.methodGenerics.clear();
if (generics != null) {
this.methodGenerics.addAll(generics);
}
}

/** Returns declared method-level generic parameters. */
public List<GenericParameterDto> getMethodGenerics() {
return methodGenerics;
}

/**
* Getting the access modifier for method. Optional for usage in stream-notation.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* MIT License
*
* Copyright (c) 2025 Andreas Igel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.javahelpers.simple.builders.processor.dtos;

/** Represents a type variable usage like T, K, V in a generic signature. */
public class TypeNameVariable extends TypeName {
/**
* Creates a TypeName representing a type variable (no package). The variable name is stored as
* className for simplicity across the existing TypeName API.
*/
public TypeNameVariable(String variableName) {
super("", variableName);
}
}
Loading
Loading