From fd655d22095dbc9762d9857168e5ea79780819bc Mon Sep 17 00:00:00 2001 From: Michael Schnell Date: Sat, 3 Feb 2024 09:08:56 +0100 Subject: [PATCH] Fixed JaCoCo reports --- .github/workflows/maven.yml | 2 +- .../common/ConstraintViolationException.java | 1 + .../org/fuin/objects4j/common/Contract.java | 2 +- .../org/fuin/objects4j/core/EmailAddress.java | 2 +- jacoco/pom.xml | 80 +++++++++++++++++++ .../java/org/fuin/objects4j/jacoco/Dummy.java | 4 + junit/pom.xml | 14 ---- ...HasPublicStaticIsValidMethodCondition.java | 4 - pom.xml | 9 ++- 9 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 jacoco/pom.xml create mode 100644 jacoco/src/main/java/org/fuin/objects4j/jacoco/Dummy.java diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f081061..9b3a551 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -60,4 +60,4 @@ jobs: OSS_SONATYPE_TOKEN: ${{ secrets.OSS_SONATYPE_TOKEN }} OSS_SONATYPE_GPG_PASSPHRASE: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./mvnw clean deploy jacoco:report sonar:sonar -U -B -P sonatype-oss-release --file pom.xml -s settings.xml + run: ./mvnw clean deploy jacoco:report -U -B -P sonatype-oss-release --file pom.xml -s settings.xml diff --git a/common/src/main/java/org/fuin/objects4j/common/ConstraintViolationException.java b/common/src/main/java/org/fuin/objects4j/common/ConstraintViolationException.java index bf62bc3..ba3eb0e 100644 --- a/common/src/main/java/org/fuin/objects4j/common/ConstraintViolationException.java +++ b/common/src/main/java/org/fuin/objects4j/common/ConstraintViolationException.java @@ -17,6 +17,7 @@ */ package org.fuin.objects4j.common; +import jakarta.annotation.Nullable; import jakarta.validation.ConstraintViolation; import jakarta.validation.constraints.NotEmpty; diff --git a/common/src/main/java/org/fuin/objects4j/common/Contract.java b/common/src/main/java/org/fuin/objects4j/common/Contract.java index ded2087..92c644f 100644 --- a/common/src/main/java/org/fuin/objects4j/common/Contract.java +++ b/common/src/main/java/org/fuin/objects4j/common/Contract.java @@ -200,7 +200,7 @@ public static void requireArgMin(@NotNull final String name, @NotNull final long public static void requireValid(@NotNull final Validator validator, @NotNull final Object value, @Nullable final Class... groups) throws ConstraintViolationException { - final Set> constraintViolations = validator.validate(value); + final Set> constraintViolations = validator.validate(value, groups); if (!constraintViolations.isEmpty()) { final StringBuilder sb = new StringBuilder(); for (final ConstraintViolation constraintViolation : constraintViolations) { diff --git a/core/src/main/java/org/fuin/objects4j/core/EmailAddress.java b/core/src/main/java/org/fuin/objects4j/core/EmailAddress.java index 4341173..d435cc4 100644 --- a/core/src/main/java/org/fuin/objects4j/core/EmailAddress.java +++ b/core/src/main/java/org/fuin/objects4j/core/EmailAddress.java @@ -144,7 +144,7 @@ private static InternetAddress parseArg(@NotNull final String name, @NotNull fin final InternetAddress[] addr = InternetAddress.parse(trimmedLowerCaseValue, false); if (addr.length != 1) { throw new ConstraintViolationException( - "The argument 'emailAddress' is not a single address: '" + trimmedLowerCaseValue + "'"); + "The argument '" + name + "' is not a single address: '" + trimmedLowerCaseValue + "'"); } return addr[0]; } catch (final AddressException ex) { diff --git a/jacoco/pom.xml b/jacoco/pom.xml new file mode 100644 index 0000000..b88a770 --- /dev/null +++ b/jacoco/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + + org.fuin.objects4j + objects4j-parent + 0.10.0-SNAPSHOT + ../pom.xml + + + objects4j-jacoco + + + + + org.fuin.objects4j + objects4j-common + + + + org.fuin.objects4j + objects4j-core + + + + org.fuin.objects4j + objects4j-jaxb + + + + org.fuin.objects4j + objects4j-jpa + + + + org.fuin.objects4j + objects4j-jsonb + + + + org.fuin.objects4j + objects4j-ui + + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + org.jacoco + jacoco-maven-plugin + + + report-aggregate + verify + + report-aggregate + + + + + + + + + + diff --git a/jacoco/src/main/java/org/fuin/objects4j/jacoco/Dummy.java b/jacoco/src/main/java/org/fuin/objects4j/jacoco/Dummy.java new file mode 100644 index 0000000..e2383cc --- /dev/null +++ b/jacoco/src/main/java/org/fuin/objects4j/jacoco/Dummy.java @@ -0,0 +1,4 @@ +package org.fuin.objects4j.jacoco; + +public class Dummy { +} diff --git a/junit/pom.xml b/junit/pom.xml index 50b90a0..86ac950 100644 --- a/junit/pom.xml +++ b/junit/pom.xml @@ -101,20 +101,6 @@ maven-surefire-plugin - - org.jacoco - jacoco-maven-plugin - - - report-aggregate - verify - - report-aggregate - - - - - org.apache.maven.plugins maven-dependency-plugin diff --git a/junit/src/main/java/org/fuin/objects4j/junit/HasPublicStaticIsValidMethodCondition.java b/junit/src/main/java/org/fuin/objects4j/junit/HasPublicStaticIsValidMethodCondition.java index 876e55a..711077b 100644 --- a/junit/src/main/java/org/fuin/objects4j/junit/HasPublicStaticIsValidMethodCondition.java +++ b/junit/src/main/java/org/fuin/objects4j/junit/HasPublicStaticIsValidMethodCondition.java @@ -7,7 +7,6 @@ import com.tngtech.archunit.lang.ConditionEvents; import com.tngtech.archunit.lang.SimpleConditionEvent; import org.fuin.objects4j.common.HasPublicStaticIsValidMethod; -import org.fuin.objects4j.common.HasPublicStaticIsValidMethodValidator; import org.fuin.objects4j.common.HasPublicStaticIsValidMethods; import java.util.Optional; @@ -20,11 +19,8 @@ */ public final class HasPublicStaticIsValidMethodCondition extends ArchCondition { - private final HasPublicStaticIsValidMethodValidator validator; - public HasPublicStaticIsValidMethodCondition() { super("have a public static 'is valid' method with the signature defined by the annotation"); - validator = new HasPublicStaticIsValidMethodValidator(); } @Override diff --git a/pom.xml b/pom.xml index ad6149f..40c10a1 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,12 @@ ${project.version} + + org.fuin.objects4j + objects4j-junit + ${project.version} + + org.fuin utils4j @@ -323,7 +329,7 @@ maven-surefire-plugin 3.2.3 - -Duser.country=US -Duser.language=en --add-opens java.base/java.util=ALL-UNNAMED + -Duser.country=US -Duser.language=en --add-opens java.base/java.util=ALL-UNNAMED ${argLine} @@ -358,6 +364,7 @@ jpa jsonb junit + jacoco