From 970e6fc2e2d3bcd20dfc51fc33e2485bfd8420a4 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 15:50:46 +0100 Subject: [PATCH 01/30] bump dependencies to ensure Java 11 compatibility --- .gitignore | 1 + .travis.yml | 1 + pom.xml | 8 +++---- .../validation/AnnotationValidatorTest.java | 24 +++++++++---------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 8054231..92cef4c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ # IDEA files /annotation-validator.iml +.idea/ diff --git a/.travis.yml b/.travis.yml index 37d7680..cb7dffe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ addons: jdk: - oraclejdk8 + - oraclejdk11 script: # JaCoCo is used to have code coverage, the agent has to be activated diff --git a/pom.xml b/pom.xml index 69add42..1d21006 100644 --- a/pom.xml +++ b/pom.xml @@ -91,13 +91,13 @@ org.assertj assertj-core - 3.9.1 + 3.13.2 org.apache.commons commons-lang3 - 3.7 + 3.9 @@ -116,13 +116,13 @@ org.hamcrest hamcrest-library - 1.3 + 2.1 test org.springframework spring-core - 5.0.4.RELEASE + 5.2.1.RELEASE test diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java index c4b238d..4d02a7b 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java +++ b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java @@ -1,12 +1,12 @@ /** * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,17 +15,17 @@ */ package de.tolina.common.validation; +import org.hamcrest.CoreMatchers; +import org.junit.Test; + import static de.tolina.common.validation.AnnotationValidator.validate; -import static org.hamcrest.Matchers.containsInAnyOrder; import static org.junit.Assert.assertThat; -import org.junit.Test; - public class AnnotationValidatorTest { - @Test - public void testValidate_DefaultBlacklist() { - final AnnotationValidation validate = validate(); - assertThat(validate.paramBlacklist, containsInAnyOrder("equals", "toString", "hashCode", "annotationType")); - } + @Test + public void testValidate_DefaultBlacklist() { + final AnnotationValidation validate = validate(); + assertThat(validate.paramBlacklist, CoreMatchers.hasItems("equals", "toString", "hashCode", "annotationType")); + } } From 62404942cfa74bee21ec069924bdb0463eadb543 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:06:36 +0100 Subject: [PATCH 02/30] bump dependencies to ensure Java 11 compatibility --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1d21006..2da80a8 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ ${java.version} ${java.version} - 0.7.5.201505241946 + 0.8.5 3.0 1.5 2.6 @@ -84,7 +84,7 @@ 3.0.1 1.6.7 2.12.4 - 4.2 + 5.14.0.18788 From d7f8559962773fbbe24efdb3fab7b7464437c690 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:17:08 +0100 Subject: [PATCH 03/30] bump dependencies to ensure Java 11 compatibility --- pom.xml | 7 +++++-- .../tolina/common/validation/AnnotationValidatorTest.java | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 2da80a8..a638f6b 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ de.tolina.common.validation annotation-validator - 2.0 + 2.0.1-SNAPSHOT jar Annotation Validator @@ -115,7 +115,7 @@ org.hamcrest - hamcrest-library + hamcrest 2.1 test @@ -135,6 +135,9 @@ maven-license-verifier-plugin ${maven-license-verifier-plugin.version} + + org.hamcrest:hamcrest:jar:2.1 + src/main/resources/licenses.xml true true diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java index 4d02a7b..ec24feb 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java +++ b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java @@ -1,12 +1,12 @@ /** * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - *

+ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

+ * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. From 739e25aa64f752c021e943add6f9422d39325467 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:19:08 +0100 Subject: [PATCH 04/30] bump dependencies to ensure Java 11 compatibility --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index cb7dffe..eff068e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty language: java sudo: false install: true From b24217215e2b356b9e7d0b01ce7b41a2cfe68359 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:27:38 +0100 Subject: [PATCH 05/30] bump dependencies to ensure Java 11 compatibility --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index eff068e..63852bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,7 @@ install: true addons: sonarqube: - organization: "arxes-tolina" - token: - secure: "Ja+klUuZ2M0ODpfbnHKt3QBLmz6UwWDmDgVMFn8NVNhYrg5tydU0NTYfTaIAlysXt5jLgQHy78jOZhcHlWrS6sEy4tRZKvkFce/BxND9/ulO5+9tqy4vYKbcY90HrT/BAdMJyXZ+DoZKT9DvCNN7jxtOrvK9OaNIiWm+goeaevRtkALCUqkGwM/hCdbHdVrv//VrLxj5WjFclWJAdvBU3TTaxE3pvTvogPSYtIJUvHo/qcKA1U7eoU/6KMq7+CVJZHff0KMth+tqB8SNhv8eCQDVfneRjtCEmUoCDDMmtBf4uc/uc0AtdTCYW3KyfyjrsOFrGm2/JxGkJ334vcQFHyPUwSnICyD+xqZbiSgi76UmA6CjYiEn+4/jyvoE0kQV0h3uYhAxxj8ShfXh88Jeh1DXL9S1Oe2W0gRhLms2winz2uz+zvEpGBfy9Q2mzwd7gWoofxfI0AnB2d0rb9IR7l88GspN8N4dvHk8aB552jRMTngCqsH8u14ab2bnJPfl1XEZmED/TxlwGOCdHCC3qLcDmc+B7t2k7V2HUjwjeQ+vEfs6aQkWYJY2ujSJmujpgxOebIC4TuvHpiuyR4kuzYGc1RJC4s7UfpJ9u5rwfmsT+l1X/AwauyW7lRPDuqainIokDEJaAh+Oi4cipI5Q4mKMfd1m/NK/cKyWsG2j/Hg=" + organization: "fjakop-github" jdk: - oraclejdk8 From 1708ea580e91363171b7651e5633477773a21b84 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:35:05 +0100 Subject: [PATCH 06/30] Create maven.yml --- .github/workflows/maven.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..3488236 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,20 @@ +name: Java CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build with Maven + run: mvn -B package org.sonarsource.scanner.maven:sonar --file pom.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From e72b0f181b4919ff03bf2aac0cfe7fc2232e37e9 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:37:34 +0100 Subject: [PATCH 07/30] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3488236..1d6c161 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -14,7 +14,7 @@ jobs: with: java-version: 1.8 - name: Build with Maven - run: mvn -B package org.sonarsource.scanner.maven:sonar --file pom.xml + run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 6d4232684e295b95a8b17d41053c9061eb8639be Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:40:42 +0100 Subject: [PATCH 08/30] bump dependencies to ensure Java 11 compatibility --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index a638f6b..f529e7e 100644 --- a/pom.xml +++ b/pom.xml @@ -85,6 +85,11 @@ 1.6.7 2.12.4 5.14.0.18788 + + fjakop_annotation-validator + fjakop-github + https://sonarcloud.io + From b5edb4f724ac87e9281ef1083fe78850e75a2d5d Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:42:55 +0100 Subject: [PATCH 09/30] bump dependencies to ensure Java 11 compatibility --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 1d6c161..818e80e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,7 +12,7 @@ jobs: - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: [ 1.8, 11 ] - name: Build with Maven run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: From d0218e9707cce421f9cb527b223778ec650112d6 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:45:29 +0100 Subject: [PATCH 10/30] bump dependencies to ensure Java 11 compatibility --- .github/workflows/maven.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 818e80e..2633504 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -4,15 +4,17 @@ on: [push] jobs: build: - runs-on: ubuntu-latest - + strategy: + matrix: + java: [ 1.8, 11, 12, 13 ] + name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 - - name: Set up JDK 1.8 + - name: Set up Java uses: actions/setup-java@v1 with: - java-version: [ 1.8, 11 ] + java-version: ${{ matrix.java }} - name: Build with Maven run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: From 7530a83965f2a4ebe8566918981e39fb2b5de931 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:49:52 +0100 Subject: [PATCH 11/30] switch from travis to Github actions --- .travis.yml | 21 --------------------- CHANGELOG.md | 3 +++ 2 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 63852bb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -dist: trusty -language: java -sudo: false -install: true - -addons: - sonarqube: - organization: "fjakop-github" - -jdk: - - oraclejdk8 - - oraclejdk11 - -script: - # JaCoCo is used to have code coverage, the agent has to be activated - - mvn clean verify sonar:sonar -Pcoverage-per-test - -cache: - directories: - - '$HOME/.m2/repository' - - '$HOME/.sonar/cache' diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f30f18..8104572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### Changed +- Dependencies updated: assertj-core, commons-lang3, spring-core, hamcrest, jacoco-maven-pugin, sonar-jacoco-listeners + ## [2.0] - 2018-03-13 ### Changed - Dependencies updated: assertj-core, commons-lang3, jsr305, spring-core From a102862f166fac34f8c0fa87269ec4fc4c611663 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 17 Dec 2019 16:53:53 +0100 Subject: [PATCH 12/30] use correct badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5cb3c31..9fb8022 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[![build status](https://travis-ci.org/arxes-tolina/annotation-validator.svg?branch=master)](https://github.com/arxes-tolina/annotation-validator/commits/master) -[![quality status](https://sonarcloud.io//api/badges/gate?key=de.tolina.common.validation%3Aannotation-validator)](https://sonarcloud.io/dashboard?id=de.tolina.common.validation%3Aannotation-validator) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fjakop_annotation-validator&metric=alert_status)](https://sonarcloud.io/dashboard?id=fjakop_annotation-validator) # Usage with Maven From 34efb8f7c9e9a3f8dd40dfcfc1191c9f1d627ff6 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:07:20 +0200 Subject: [PATCH 13/30] overtake project for maintenance --- .github/workflows/maven.yml | 20 ++++++++- pom.xml | 43 +++++++------------ .../validation/AnnotationDefinition.java | 2 + .../validation/AnnotationValidation.java | 2 + .../validation/AnnotationValidator.java | 2 + .../SoftAssertionErrorWithObjectDetails.java | 2 + .../common/validation/ValidationMode.java | 3 +- .../resources/APACHE-2-with-modifications.txt | 15 +++++++ .../validation/AliasTestAnnotation.java | 2 + .../AnnotatedAbstractTestClass.java | 2 + .../AnnotatedAbstractTestClassAnnotation.java | 2 + .../common/validation/AnnotatedTestClass.java | 2 + .../validation/AnnotatedTestInterface.java | 2 + .../AnnotatedTestInterfaceAnnotation.java | 2 + ...nnotatedTestInterfaceForAbstractClass.java | 2 + ...stInterfaceForAbstractClassAnnotation.java | 2 + .../validation/AnnotationValidationTest.java | 2 + .../validation/AnnotationValidatorTest.java | 2 + .../validation/AnotherTestAnnotation.java | 2 + .../common/validation/TestAnnotation.java | 2 + .../de/tolina/common/validation/TestEnum.java | 2 + 21 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/APACHE-2-with-modifications.txt diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2633504..39b5d1a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,3 +1,21 @@ +# +# Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Modifications copyright (C) 2020 Frank Jakop +# + name: Java CI on: [push] @@ -16,7 +34,7 @@ jobs: with: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml + run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index f529e7e..d942846 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. + Modifications copyright (C) 2020 Frank Jakop + --> @@ -31,12 +33,7 @@ Check classes, methods or fields for annotations with specific parameters. - 2016 - - - arxes-tolina GmbH - https://www.arxes-tolina.de - + 2020 @@ -46,25 +43,17 @@ - - Ron Peters - ron.peters@arxes-tolina.de - - - Matthias Hartmann - matthias.hartmann@signavio.com - Frank Jakop - http://github.com/arxes-tolina/annotation-validator + http://github.com/fjakop/annotation-validator - scm:git:ssh://git@github.com/arxes-tolina/annotation-validator.git - scm:git:ssh://git@github.com/arxes-tolina/annotation-validator.git - https://github.com/arxes-tolina/annotation-validator + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + https://github.com/fjakop/annotation-validator @@ -96,13 +85,13 @@ org.assertj assertj-core - 3.13.2 + 3.17.2 org.apache.commons commons-lang3 - 3.9 + 3.11 @@ -114,20 +103,20 @@ junit junit - 4.12 + 4.13 test org.hamcrest hamcrest - 2.1 + 2.2 test org.springframework spring-core - 5.2.1.RELEASE + 5.2.8.RELEASE test @@ -141,7 +130,7 @@ ${maven-license-verifier-plugin.version} - org.hamcrest:hamcrest:jar:2.1 + org.hamcrest:hamcrest:jar:2.2 src/main/resources/licenses.xml true @@ -164,10 +153,10 @@ true true -

com/mycila/maven/plugin/license/templates/APACHE-2.txt
+
APACHE-2-with-modifications.txt
- ${project.organization.name} - entwicklung@arxes-tolina.de + Frank Jakop + **/README.md diff --git a/src/main/java/de/tolina/common/validation/AnnotationDefinition.java b/src/main/java/de/tolina/common/validation/AnnotationDefinition.java index 9a1321b..4617696 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationDefinition.java +++ b/src/main/java/de/tolina/common/validation/AnnotationDefinition.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/main/java/de/tolina/common/validation/AnnotationValidation.java b/src/main/java/de/tolina/common/validation/AnnotationValidation.java index c7d3435..87eeaec 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationValidation.java +++ b/src/main/java/de/tolina/common/validation/AnnotationValidation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/main/java/de/tolina/common/validation/AnnotationValidator.java b/src/main/java/de/tolina/common/validation/AnnotationValidator.java index 18cac22..ba96dd6 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationValidator.java +++ b/src/main/java/de/tolina/common/validation/AnnotationValidator.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java b/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java index a978ea5..84a3cfd 100644 --- a/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java +++ b/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ /* * (c) tolina GmbH, 2017 diff --git a/src/main/java/de/tolina/common/validation/ValidationMode.java b/src/main/java/de/tolina/common/validation/ValidationMode.java index 228d47d..baaa25c 100644 --- a/src/main/java/de/tolina/common/validation/ValidationMode.java +++ b/src/main/java/de/tolina/common/validation/ValidationMode.java @@ -12,8 +12,9 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ - package de.tolina.common.validation; public enum ValidationMode { diff --git a/src/main/resources/APACHE-2-with-modifications.txt b/src/main/resources/APACHE-2-with-modifications.txt new file mode 100644 index 0000000..e988120 --- /dev/null +++ b/src/main/resources/APACHE-2-with-modifications.txt @@ -0,0 +1,15 @@ +Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Modifications copyright (C) ${project.inceptionYear} ${owner} diff --git a/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java b/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java index 1327929..14cf6c6 100644 --- a/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java +++ b/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java b/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java index 2fe6f93..6abc429 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java b/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java index da906c8..c2de89e 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java b/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java index b679ce4..f34d7d4 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java b/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java index a522076..dd927ce 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java index da2f893..8583f16 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java index 3ac6d78..02b64ee 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java index 01be516..7c56525 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java +++ b/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java b/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java index f6278cc..baea66a 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java +++ b/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java index ec24feb..af3e575 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java +++ b/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java b/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java index 68e9dd0..144362f 100644 --- a/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java +++ b/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/TestAnnotation.java b/src/test/java/de/tolina/common/validation/TestAnnotation.java index 6f0ca9e..b3d6f6d 100644 --- a/src/test/java/de/tolina/common/validation/TestAnnotation.java +++ b/src/test/java/de/tolina/common/validation/TestAnnotation.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; diff --git a/src/test/java/de/tolina/common/validation/TestEnum.java b/src/test/java/de/tolina/common/validation/TestEnum.java index 100d154..92eb7bb 100644 --- a/src/test/java/de/tolina/common/validation/TestEnum.java +++ b/src/test/java/de/tolina/common/validation/TestEnum.java @@ -12,6 +12,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop */ package de.tolina.common.validation; From 0acc304df2e70721cdde10f58f8d0ef1aa64142a Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:13:22 +0200 Subject: [PATCH 14/30] overtake project for maintenance --- README.md | 8 +- pom.xml | 2 +- .../annotations}/AnnotationDefinition.java | 2 +- .../annotations}/AnnotationValidation.java | 15 ++- .../annotations}/AnnotationValidator.java | 2 +- .../SoftAssertionErrorWithObjectDetails.java | 2 +- .../annotations}/ValidationMode.java | 2 +- .../annotations}/AliasTestAnnotation.java | 8 +- .../AnnotatedAbstractTestClass.java | 2 +- .../AnnotatedAbstractTestClassAnnotation.java | 2 +- .../annotations}/AnnotatedTestClass.java | 6 +- .../annotations}/AnnotatedTestInterface.java | 2 +- .../AnnotatedTestInterfaceAnnotation.java | 2 +- ...nnotatedTestInterfaceForAbstractClass.java | 2 +- ...stInterfaceForAbstractClassAnnotation.java | 2 +- .../AnnotationValidationTest.java | 106 +++++++++--------- .../annotations}/AnnotationValidatorTest.java | 5 +- .../annotations}/AnotherTestAnnotation.java | 6 +- .../annotations}/TestAnnotation.java | 2 +- .../validation/annotations}/TestEnum.java | 2 +- 20 files changed, 87 insertions(+), 93 deletions(-) rename src/main/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotationDefinition.java (95%) rename src/main/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotationValidation.java (95%) rename src/main/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotationValidator.java (94%) rename src/main/java/de/{tolina/common/validation => jakop/validation/annotations}/SoftAssertionErrorWithObjectDetails.java (94%) rename src/main/java/de/{tolina/common/validation => jakop/validation/annotations}/ValidationMode.java (92%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AliasTestAnnotation.java (79%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedAbstractTestClass.java (93%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedAbstractTestClassAnnotation.java (92%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedTestClass.java (89%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedTestInterface.java (92%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedTestInterfaceAnnotation.java (92%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedTestInterfaceForAbstractClass.java (93%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotatedTestInterfaceForAbstractClassAnnotation.java (92%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotationValidationTest.java (63%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnnotationValidatorTest.java (83%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/AnotherTestAnnotation.java (84%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/TestAnnotation.java (93%) rename src/test/java/de/{tolina/common/validation => jakop/validation/annotations}/TestEnum.java (92%) diff --git a/README.md b/README.md index 9fb8022..4b3430a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Add the following dependency to your pom.xml ``` - de.tolina.common.validation + de.jakop.validation annotation-validator 1.0 test @@ -34,7 +34,7 @@ class AnnotatedTestClass { If you would like to check the class to be annotated only with `@MyAnnotation` and only have the configured params use the following ``` -import static de.tolina.common.validation.AnnotationDefinition.*; +import static AnnotationDefinition.*; ... @@ -47,7 +47,7 @@ validate().exactly() // If you would like to check the class to be annotated only with `@MyAnnotation` but also want to consider default values for not configured params use the following ``` -import static de.tolina.common.validation.AnnotationDefinition.*; +import static AnnotationDefinition.*; ... @@ -74,4 +74,4 @@ validate() // .param("value", TEST)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); -``` \ No newline at end of file +``` diff --git a/pom.xml b/pom.xml index d942846..f03b23e 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - de.tolina.common.validation + de.jakop annotation-validator 2.0.1-SNAPSHOT jar diff --git a/src/main/java/de/tolina/common/validation/AnnotationDefinition.java b/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java similarity index 95% rename from src/main/java/de/tolina/common/validation/AnnotationDefinition.java rename to src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java index 4617696..838744f 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationDefinition.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import java.lang.annotation.Annotation; import java.util.ArrayList; diff --git a/src/main/java/de/tolina/common/validation/AnnotationValidation.java b/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java similarity index 95% rename from src/main/java/de/tolina/common/validation/AnnotationValidation.java rename to src/main/java/de/jakop/validation/annotations/AnnotationValidation.java index 87eeaec..0fedcfd 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationValidation.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.StringUtils; @@ -33,7 +33,6 @@ import java.lang.reflect.Method; import java.util.*; -import static de.tolina.common.validation.ValidationMode.*; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -54,7 +53,7 @@ public class AnnotationValidation { AnnotationValidation( @Nonnull final HashSet parametersBlacklist) { - validationMode = DEFAULT; + validationMode = ValidationMode.DEFAULT; paramBlacklist = parametersBlacklist; annotationDefinitions = new ArrayList<>(); } @@ -81,7 +80,7 @@ public AnnotationValidation annotation( */ @Nonnull public AnnotationValidation exactly() { - validationMode = EXACTLY; + validationMode = ValidationMode.EXACTLY; return this; } @@ -93,7 +92,7 @@ public AnnotationValidation exactly() { */ @Nonnull public AnnotationValidation only() { - validationMode = ONLY; + validationMode = ValidationMode.ONLY; return this; } @@ -177,11 +176,11 @@ private void forClassOrMethodOrField( }); } - softly.assertThat(validationMode == DEFAULT && annotationDefinitions.isEmpty()) + softly.assertThat(validationMode == ValidationMode.DEFAULT && annotationDefinitions.isEmpty()) .as("Please add at least one Annotation to assert or enable strict validation.") .isFalse(); - if (validationMode != DEFAULT) { + if (validationMode != ValidationMode.DEFAULT) { softly.assertThat(allAnnotations) .extracting(annotation -> annotation.annotationType().getName()) .containsExactlyElementsOf(annotationsList); @@ -226,7 +225,7 @@ private void checkForUndefinedMethodsInAnnotation( try { methodResult = declaredMethod.invoke(annotation); - if (validationMode != EXACTLY) { + if (validationMode != ValidationMode.EXACTLY) { Object defaultValue = declaredMethod.getDefaultValue(); softly.assertThat(methodResult) diff --git a/src/main/java/de/tolina/common/validation/AnnotationValidator.java b/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java similarity index 94% rename from src/main/java/de/tolina/common/validation/AnnotationValidator.java rename to src/main/java/de/jakop/validation/annotations/AnnotationValidator.java index ba96dd6..8be769d 100644 --- a/src/main/java/de/tolina/common/validation/AnnotationValidator.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import java.util.HashSet; diff --git a/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java b/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java similarity index 94% rename from src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java rename to src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java index 84a3cfd..7c7b0d6 100644 --- a/src/main/java/de/tolina/common/validation/SoftAssertionErrorWithObjectDetails.java +++ b/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java @@ -18,7 +18,7 @@ /* * (c) tolina GmbH, 2017 */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import java.util.List; diff --git a/src/main/java/de/tolina/common/validation/ValidationMode.java b/src/main/java/de/jakop/validation/annotations/ValidationMode.java similarity index 92% rename from src/main/java/de/tolina/common/validation/ValidationMode.java rename to src/main/java/de/jakop/validation/annotations/ValidationMode.java index baaa25c..cfa7b86 100644 --- a/src/main/java/de/tolina/common/validation/ValidationMode.java +++ b/src/main/java/de/jakop/validation/annotations/ValidationMode.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; public enum ValidationMode { DEFAULT, ONLY, EXACTLY diff --git a/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java b/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java similarity index 79% rename from src/test/java/de/tolina/common/validation/AliasTestAnnotation.java rename to src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java index 14cf6c6..13486dc 100644 --- a/src/test/java/de/tolina/common/validation/AliasTestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java @@ -15,14 +15,12 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import org.springframework.core.annotation.AliasFor; import java.lang.annotation.Retention; -import static de.tolina.common.validation.TestEnum.TEST; -import static de.tolina.common.validation.TestEnum.TEST2; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) @@ -30,8 +28,8 @@ @AnotherTestAnnotation public @interface AliasTestAnnotation { @AliasFor(annotation = AnotherTestAnnotation.class, attribute = "testEnum") - TestEnum referencedTestEnum() default TEST; + TestEnum referencedTestEnum() default TestEnum.TEST; @AliasFor(annotation = AnotherTestAnnotation.class) - TestEnum anotherValue() default TEST2; + TestEnum anotherValue() default TestEnum.TEST2; } diff --git a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java similarity index 93% rename from src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java index 6abc429..fb7507a 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; @AnnotatedAbstractTestClassAnnotation @SuppressWarnings("javadoc") diff --git a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java similarity index 92% rename from src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java index c2de89e..7865c89 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedAbstractTestClassAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import static java.lang.annotation.RetentionPolicy.RUNTIME; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java similarity index 89% rename from src/test/java/de/tolina/common/validation/AnnotatedTestClass.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java index f34d7d4..64b9c22 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java @@ -15,10 +15,10 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; -import static de.tolina.common.validation.TestEnum.TEST; -import static de.tolina.common.validation.TestEnum.TEST2; +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; @TestAnnotation @SuppressWarnings("javadoc") diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java similarity index 92% rename from src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java index dd927ce..9443ad3 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterface.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; @AnnotatedTestInterfaceAnnotation @SuppressWarnings("javadoc") diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java similarity index 92% rename from src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java index 8583f16..a5b9177 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import static java.lang.annotation.RetentionPolicy.RUNTIME; diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java similarity index 93% rename from src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java index 02b64ee..a57619d 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; @AnnotatedTestInterfaceForAbstractClassAnnotation @SuppressWarnings("javadoc") diff --git a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java similarity index 92% rename from src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java rename to src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java index 7c56525..006f102 100644 --- a/src/test/java/de/tolina/common/validation/AnnotatedTestInterfaceForAbstractClassAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import static java.lang.annotation.RetentionPolicy.RUNTIME; diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java similarity index 63% rename from src/test/java/de/tolina/common/validation/AnnotationValidationTest.java rename to src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java index baea66a..c584592 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidationTest.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import org.junit.Rule; import org.junit.Test; @@ -23,10 +23,8 @@ import java.lang.reflect.Method; -import static de.tolina.common.validation.AnnotationDefinition.type; -import static de.tolina.common.validation.AnnotationValidator.validate; -import static de.tolina.common.validation.TestEnum.TEST; -import static de.tolina.common.validation.TestEnum.TEST2; +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; /** * Test for the {@link AnnotationValidator} @@ -39,23 +37,23 @@ public class AnnotationValidationTest { @Test public void testValidateAnnotatedClass_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { - validate().exactly() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("testparameter", "default") // .param("anotherTestParameter", "one", "two")) // - .annotation(type(AnnotatedTestInterfaceAnnotation.class)) // - .annotation(type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // - .annotation(type(AnnotatedAbstractTestClassAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // .forClass(AnnotatedTestClass.class); } @Test public void testValidateAnnotatedClass_only_defaultsAreEvaluated() throws NoSuchMethodException { - validate().only() // - .annotation(type(TestAnnotation.class)) // - .annotation(type(AnnotatedTestInterfaceAnnotation.class)) // - .annotation(type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // - .annotation(type(AnnotatedAbstractTestClassAnnotation.class)) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // .forClass(AnnotatedTestClass.class); } @@ -64,15 +62,15 @@ public void testValidateAnnotatedClass_only_defaultsAreEvaluated() throws NoSuch public void testValidateAnnotatedClass_NotExactlyAndNoAnnotationsValidated() throws NoSuchMethodException { thrown.expect(AssertionError.class); thrown.expectMessage("Please add at least one Annotation to assert or enable strict validation."); - validate() // + AnnotationValidator.validate() // .forClass(AnnotatedTestClass.class); } @Test public void testValidateAnnotatedClass_NotExactly() throws NoSuchMethodException { - validate() // - .annotation(type(AnnotatedTestInterfaceAnnotation.class)) // + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // .forClass(AnnotatedTestClass.class); } @@ -82,8 +80,8 @@ public void testValidateAnnotatedClass_NoSuchAnnotationMethod() throws NoSuchMet thrown.expect(AssertionError.class); thrown.expectMessage("Method noSuchMethod not found"); - validate().exactly() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("noSuchMethod", "default")) // .forClass(AnnotatedTestClass.class); } @@ -91,11 +89,11 @@ public void testValidateAnnotatedClass_NoSuchAnnotationMethod() throws NoSuchMet @Test public void testValidateAnnotatedMethod_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { - validate().only() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("testparameter", "testvalue") // .param("anotherTestParameter", "anotherTestValue")) // - .annotation(type(AnotherTestAnnotation.class) // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // .param("testEnum", TEST2)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); } @@ -103,11 +101,11 @@ public void testValidateAnnotatedMethod_exactly_defaultsAreNotEvaluated() throws @Test public void testValidateAnnotatedMethod_only_defaultsAreEvaluated() throws NoSuchMethodException { - validate().only() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("testparameter", "testvalue") // .param("anotherTestParameter", "anotherTestValue")) // - .annotation(type(AnotherTestAnnotation.class) // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // .param("testEnum", TEST2)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); } @@ -119,8 +117,8 @@ public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotati thrown.expect(AssertionError.class); thrown.expectMessage("Unexpected value for Method 'testparameter' found"); - validate() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("anotherTestParameter", "anotherTestValue")) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); } @@ -129,16 +127,16 @@ public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotati @Test public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotationDefinition_NonStringValues() throws NoSuchMethodException { - validate() // - .annotation(type(AnotherTestAnnotation.class).param("value", TEST2)) // + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class).param("value", TEST2)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); } @Test public void testValidateAnnotatedMethod_OverloadedMethod() throws NoSuchMethodException { - validate().only() // - .annotation(type(AnotherTestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // .param("testEnum", TEST) // .param("value", TEST)) // .forMethod(AnnotatedTestClass.class.getMethod("overloadedMethod", String.class, String.class)); @@ -147,8 +145,8 @@ public void testValidateAnnotatedMethod_OverloadedMethod() throws NoSuchMethodEx @Test public void testValidateAnnotatedMethod_UseAlias() throws NoSuchMethodException { - validate().only() // - .annotation(type(AliasTestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // .param("referencedTestEnum", TEST2)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAliasAnnotations")); } @@ -156,8 +154,8 @@ public void testValidateAnnotatedMethod_UseAlias() throws NoSuchMethodException @Test public void testValidateAnnotatedMethod_UseAlias_WithoutAttribute() throws NoSuchMethodException { - validate().only() // - .annotation(type(AliasTestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // .param("anotherValue", TEST)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnOtherAliasAnnotations")); } @@ -165,32 +163,32 @@ public void testValidateAnnotatedMethod_UseAlias_WithoutAttribute() throws NoSuc @Test public void testValidateAnnotatedInterfaceMethod() throws NoSuchMethodException { - validate().exactly() // - .annotation(type(AnnotatedTestInterfaceAnnotation.class)) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethod")); } @Test public void testValidateAnnotatedInterfaceMethodFromSuperclass() throws NoSuchMethodException { - validate().exactly() // - .annotation(type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethodForAbstractClass")); } @Test public void testValidateAnnotatedAbstractMethodFromSuperclass() throws NoSuchMethodException { - validate().exactly() // - .annotation(type(AnnotatedAbstractTestClassAnnotation.class)) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // .forMethod(AnnotatedTestClass.class.getDeclaredMethod("annotatedAbstractMethod")); } @Test public void testValidateAnnotatedField_exactly_defaultsAreNotEvaluated() throws NoSuchFieldException { - validate().exactly() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("testparameter", "testvalue") .param("anotherTestParameter", "one", "two")) // .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); @@ -199,8 +197,8 @@ public void testValidateAnnotatedField_exactly_defaultsAreNotEvaluated() throws @Test public void testValidateAnnotatedField_only_defaultsAreEvaluated() throws NoSuchFieldException { - validate().only() // - .annotation(type(TestAnnotation.class) // + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // .param("testparameter", "testvalue")) // .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); } @@ -208,7 +206,7 @@ public void testValidateAnnotatedField_only_defaultsAreEvaluated() throws NoSuch @Test public void testValidateMethod() throws NoSuchMethodException { - validate().exactly()// + AnnotationValidator.validate().exactly()// .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); } @@ -216,9 +214,9 @@ public void testValidateMethod() throws NoSuchMethodException { @Test public void testValidateMethod_AnnotationNotPresent() throws NoSuchMethodException { thrown.expect(AssertionError.class); - thrown.expectMessage("Expected Annotation de.tolina.common.validation.TestAnnotation not found"); - validate().exactly()// - .annotation(type(TestAnnotation.class)) // + thrown.expectMessage("Expected Annotation de.jakop.annotation.validator.TestAnnotation not found"); + AnnotationValidator.validate().exactly()// + .annotation(AnnotationDefinition.type(TestAnnotation.class)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); } @@ -226,14 +224,14 @@ public void testValidateMethod_AnnotationNotPresent() throws NoSuchMethodExcepti @Test public void testValidateMethod_NoSuchMethod() throws NoSuchMethodException { thrown.expect(NoSuchMethodException.class); - validate().exactly()// + AnnotationValidator.validate().exactly()// .forMethod(AnnotatedTestClass.class.getMethod("noSuchMethod")); } @Test public void testValidateField() throws NoSuchFieldException { - validate().exactly().forField(AnnotatedTestClass.class.getDeclaredField("fieldWithoutAnnotations")); + AnnotationValidator.validate().exactly().forField(AnnotatedTestClass.class.getDeclaredField("fieldWithoutAnnotations")); } @@ -241,11 +239,11 @@ public void testValidateField() throws NoSuchFieldException { public void testValidateLambdas() throws Exception { TestInterface test1 = TestInterface::staticMethod; Method annotatedMethod1 = test1.getClass().getMethod("method"); - validate().annotation(type(Deprecated.class)).forMethod(annotatedMethod1); + AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod1); TestInterface test2 = test1::defaultMethod; Method annotatedMethod2 = test2.getClass().getMethod("defaultMethod"); - validate().annotation(type(Deprecated.class)).forMethod(annotatedMethod2); + AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod2); } diff --git a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java b/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java similarity index 83% rename from src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java rename to src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java index af3e575..ebb40e6 100644 --- a/src/test/java/de/tolina/common/validation/AnnotationValidatorTest.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java @@ -15,18 +15,17 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import org.hamcrest.CoreMatchers; import org.junit.Test; -import static de.tolina.common.validation.AnnotationValidator.validate; import static org.junit.Assert.assertThat; public class AnnotationValidatorTest { @Test public void testValidate_DefaultBlacklist() { - final AnnotationValidation validate = validate(); + final AnnotationValidation validate = AnnotationValidator.validate(); assertThat(validate.paramBlacklist, CoreMatchers.hasItems("equals", "toString", "hashCode", "annotationType")); } diff --git a/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java similarity index 84% rename from src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java rename to src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java index 144362f..6bb0d05 100644 --- a/src/test/java/de/tolina/common/validation/AnotherTestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java @@ -15,14 +15,14 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import org.springframework.core.annotation.AliasFor; import java.lang.annotation.Retention; -import static de.tolina.common.validation.TestEnum.TEST; -import static de.tolina.common.validation.TestEnum.TEST2; +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) diff --git a/src/test/java/de/tolina/common/validation/TestAnnotation.java b/src/test/java/de/jakop/validation/annotations/TestAnnotation.java similarity index 93% rename from src/test/java/de/tolina/common/validation/TestAnnotation.java rename to src/test/java/de/jakop/validation/annotations/TestAnnotation.java index b3d6f6d..3330bbc 100644 --- a/src/test/java/de/tolina/common/validation/TestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/TestAnnotation.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; import static java.lang.annotation.RetentionPolicy.RUNTIME; diff --git a/src/test/java/de/tolina/common/validation/TestEnum.java b/src/test/java/de/jakop/validation/annotations/TestEnum.java similarity index 92% rename from src/test/java/de/tolina/common/validation/TestEnum.java rename to src/test/java/de/jakop/validation/annotations/TestEnum.java index 92eb7bb..65c6714 100644 --- a/src/test/java/de/tolina/common/validation/TestEnum.java +++ b/src/test/java/de/jakop/validation/annotations/TestEnum.java @@ -15,7 +15,7 @@ * * Modifications copyright (C) 2020 Frank Jakop */ -package de.tolina.common.validation; +package de.jakop.validation.annotations; @SuppressWarnings("javadoc") public enum TestEnum { From 58d89b379c7f2fb902d9969438f9e4b98d03b848 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:23:17 +0200 Subject: [PATCH 15/30] dependency bump --- pom.xml | 36 ++++++++++++++----- .../annotations/AnnotationValidationTest.java | 2 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index f03b23e..96fcdca 100644 --- a/pom.xml +++ b/pom.xml @@ -65,14 +65,15 @@ 0.8.5 3.0 - 1.5 - 2.6 - 2.9.1 + 3.0.0-M3 + 1.6 + 3.2.0 + 3.2.0 0.4 - 2.5.3 - 3.0.1 - 1.6.7 - 2.12.4 + 3.0.0-M1 + 3.2.1 + 1.6.8 + 3.0.0-M5 5.14.0.18788 fjakop_annotation-validator @@ -123,7 +124,26 @@ - + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-maven + + enforce + + + + + 3.3.9 + + + + + + com.soebes.maven.plugins.mlv maven-license-verifier-plugin diff --git a/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java index c584592..436ba8b 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java @@ -214,7 +214,7 @@ public void testValidateMethod() throws NoSuchMethodException { @Test public void testValidateMethod_AnnotationNotPresent() throws NoSuchMethodException { thrown.expect(AssertionError.class); - thrown.expectMessage("Expected Annotation de.jakop.annotation.validator.TestAnnotation not found"); + thrown.expectMessage("Expected Annotation de.jakop.validation.annotations.TestAnnotation not found"); AnnotationValidator.validate().exactly()// .annotation(AnnotationDefinition.type(TestAnnotation.class)) // .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); From 6334b8a543d63296d4fa65008d40d9c44b365f00 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:26:42 +0200 Subject: [PATCH 16/30] dependency bump --- CHANGELOG.md | 5 +++-- pom.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8104572..07dfcc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog ### Changed -- Dependencies updated: assertj-core, commons-lang3, spring-core, hamcrest, jacoco-maven-pugin, sonar-jacoco-listeners +- Moved to new coordinates de.jakop.validation:annotation-validator +- Multiple dependencies updated ## [2.0] - 2018-03-13 ### Changed @@ -12,4 +13,4 @@ - Support for Annotations that use @AliasFor without attributes ### Changed -- Fixed a false positive in @AliasFor validation \ No newline at end of file +- Fixed a false positive in @AliasFor validation diff --git a/pom.xml b/pom.xml index 96fcdca..d64b9a6 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - de.jakop + de.jakop.validation annotation-validator 2.0.1-SNAPSHOT jar From 0e81851d87b0a92c81eb374aeed1c0180400ca6a Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:27:11 +0200 Subject: [PATCH 17/30] fix line endings --- .../annotations/AnnotationDefinition.java | 188 ++-- .../annotations/AnnotationValidation.java | 964 +++++++++--------- .../annotations/AnnotationValidator.java | 102 +- .../SoftAssertionErrorWithObjectDetails.java | 82 +- .../annotations/ValidationMode.java | 44 +- .../annotations/AliasTestAnnotation.java | 70 +- .../AnnotatedAbstractTestClass.java | 66 +- .../AnnotatedAbstractTestClassAnnotation.java | 54 +- .../annotations/AnnotatedTestClass.java | 150 +-- .../annotations/AnnotatedTestInterface.java | 50 +- .../AnnotatedTestInterfaceAnnotation.java | 54 +- ...nnotatedTestInterfaceForAbstractClass.java | 50 +- ...stInterfaceForAbstractClassAnnotation.java | 54 +- .../annotations/AnnotationValidationTest.java | 532 +++++----- .../annotations/AnnotationValidatorTest.java | 64 +- .../annotations/AnotherTestAnnotation.java | 78 +- .../annotations/TestAnnotation.java | 60 +- .../validation/annotations/TestEnum.java | 46 +- 18 files changed, 1354 insertions(+), 1354 deletions(-) diff --git a/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java b/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java index 838744f..c97ed07 100644 --- a/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationDefinition.java @@ -1,94 +1,94 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * Combines an Annotation Class with optional {@link AnnotationMethodDefinition}s - */ -public class AnnotationDefinition { - private Class annotation; - private List annotationMethodDefinitions; - - private AnnotationDefinition(@Nonnull final Class annotation) { - this.annotation = annotation; - annotationMethodDefinitions = new ArrayList<>(); - } - - /** - * Describes an Annotation type - * - * @param annotationType - Type of the Annotation - */ - @Nonnull - public static AnnotationDefinition type(@Nonnull final Class annotationType) { - return new AnnotationDefinition(annotationType); - } - - /** - * Describes an Annotation parameter - * - * @param method Name of the Method that represents the Parameter - * @param values Values of the parameter - */ - @Nonnull - public AnnotationDefinition param(@Nonnull final String method, @Nullable final Object... values) { - final AnnotationMethodDefinition annotationMethodDefinition = new AnnotationMethodDefinition(method, values); - annotationMethodDefinitions.add(annotationMethodDefinition); - return AnnotationDefinition.this; - } - - @Nonnull - Class getAnnotation() { - return annotation; - } - - @Nonnull - List getAnnotationMethodDefinitions() { - return annotationMethodDefinitions; - } - - /** - * Holds Method names and Parameters - */ - static class AnnotationMethodDefinition { - private String method; - private Object[] values; - - private AnnotationMethodDefinition(@Nonnull final String method, @Nullable final Object[] values) { - this.method = method; - this.values = values; - } - - @Nonnull - String getMethod() { - return method; - } - - @Nullable - Object[] getValues() { - return values; - } - } -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Combines an Annotation Class with optional {@link AnnotationMethodDefinition}s + */ +public class AnnotationDefinition { + private Class annotation; + private List annotationMethodDefinitions; + + private AnnotationDefinition(@Nonnull final Class annotation) { + this.annotation = annotation; + annotationMethodDefinitions = new ArrayList<>(); + } + + /** + * Describes an Annotation type + * + * @param annotationType - Type of the Annotation + */ + @Nonnull + public static AnnotationDefinition type(@Nonnull final Class annotationType) { + return new AnnotationDefinition(annotationType); + } + + /** + * Describes an Annotation parameter + * + * @param method Name of the Method that represents the Parameter + * @param values Values of the parameter + */ + @Nonnull + public AnnotationDefinition param(@Nonnull final String method, @Nullable final Object... values) { + final AnnotationMethodDefinition annotationMethodDefinition = new AnnotationMethodDefinition(method, values); + annotationMethodDefinitions.add(annotationMethodDefinition); + return AnnotationDefinition.this; + } + + @Nonnull + Class getAnnotation() { + return annotation; + } + + @Nonnull + List getAnnotationMethodDefinitions() { + return annotationMethodDefinitions; + } + + /** + * Holds Method names and Parameters + */ + static class AnnotationMethodDefinition { + private String method; + private Object[] values; + + private AnnotationMethodDefinition(@Nonnull final String method, @Nullable final Object[] values) { + this.method = method; + this.values = values; + } + + @Nonnull + String getMethod() { + return method; + } + + @Nullable + Object[] getValues() { + return values; + } + } +} diff --git a/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java b/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java index 0fedcfd..68d1fab 100644 --- a/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationValidation.java @@ -1,482 +1,482 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import org.apache.commons.lang3.ClassUtils; -import org.apache.commons.lang3.StringUtils; -import org.assertj.core.api.SoftAssertionError; -import org.assertj.core.api.SoftAssertions; -import org.assertj.core.util.Lists; -import org.assertj.core.util.VisibleForTesting; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.*; - -import static java.lang.String.format; -import static org.assertj.core.api.Assertions.assertThat; - - -/** - * API for {@link AnnotationValidator} - */ -public class AnnotationValidation { - - @VisibleForTesting - HashSet paramBlacklist; - private List annotationDefinitions; - private ValidationMode validationMode; - private Annotation[] allAnnotations; - private static final String - ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE = "Could not access/invoke aliased method for '%s'."; - - - AnnotationValidation( - @Nonnull final HashSet parametersBlacklist) { - validationMode = ValidationMode.DEFAULT; - paramBlacklist = parametersBlacklist; - annotationDefinitions = new ArrayList<>(); - } - - - /** - * Adds an {@link AnnotationDefinition} to the Validator - * - * @param annotationDefinition the Annotation - * @return the AnnotationValidator - */ - @Nonnull - public AnnotationValidation annotation( - @Nonnull final AnnotationDefinition annotationDefinition) { - annotationDefinitions.add(annotationDefinition); - return this; - } - - - /** - * Validates that no other Annotations are defined and only the defined params are present. - * - * @return the AnnotationValidator - */ - @Nonnull - public AnnotationValidation exactly() { - validationMode = ValidationMode.EXACTLY; - return this; - } - - - /** - * Validates that no other Annotations are defined considering default values for undefined params. - * - * @return the AnnotationValidator - */ - @Nonnull - public AnnotationValidation only() { - validationMode = ValidationMode.ONLY; - return this; - } - - - /** - * Validates Annotations of the given Class and checks that: - *
- all given Annotations are found - *
- no other Annotations are on the given Class - *
- Annotations are in correct order - * - * @param annotatedClass Class to be validated - */ - public void forClass( - @Nonnull final Class annotatedClass) { - forClassOrMethodOrField(annotatedClass); - } - - - public void forConstructor(@Nonnull final Constructor annotatedContructor) { - forClassOrMethodOrField(annotatedContructor); - } - - - /** - * Validates Annotations of the given Method and checks that: - *
- all given Annotations are found - *
- no other Annotations are on the given Method - *
- Annotations are in correct order - * - * @param annotatedMethod Method to be validated - */ - public void forMethod( - @Nonnull final Method annotatedMethod) { - forClassOrMethodOrField(annotatedMethod); - } - - - /** - * Validates Annotations of the given Field and checks that: - *
- all given Annotations are found - *
- no other Annotations are on the given Filed - *
- Annotations are in correct order - * - * @param annotatedField Field to be validated - */ - public void forField( - @Nonnull final Field annotatedField) { - forClassOrMethodOrField(annotatedField); - } - - - /** - * Validates the configured Annotations - * - * @param annotatedObject can be a Class, a Method or a Field - */ - private void forClassOrMethodOrField( - @Nonnull final Object annotatedObject) { - final SoftAssertions softly = new SoftAssertions(); - final List annotationsList = new ArrayList<>(); - allAnnotations = getAllAnnotationsFor(annotatedObject); - - for (final AnnotationDefinition annotationDefinition : annotationDefinitions) { - // check if annotation is present - final Optional foundAnnotation = - findAnnotationFor(annotationDefinition.getAnnotation()); - - softly.assertThat(foundAnnotation) - .as("Expected Annotation %s not found", annotationDefinition.getAnnotation().getName()) - .isPresent(); - - foundAnnotation.ifPresent(annotation -> { - annotationsList.add(annotation.annotationType().getName()); - - // check all methods defined in annotation definition against current annotation's methods - final List validatedMethods = - validateAllMethodsOfAnnotationDefinition(softly, annotationDefinition, annotation); - - // check if there are undefined methods in annotation definition present in annotation - checkForUndefinedMethodsInAnnotation(softly, annotation, validatedMethods); - }); - } - - softly.assertThat(validationMode == ValidationMode.DEFAULT && annotationDefinitions.isEmpty()) - .as("Please add at least one Annotation to assert or enable strict validation.") - .isFalse(); - - if (validationMode != ValidationMode.DEFAULT) { - softly.assertThat(allAnnotations) - .extracting(annotation -> annotation.annotationType().getName()) - .containsExactlyElementsOf(annotationsList); - } - try { - softly.assertAll(); - } catch (final SoftAssertionError sae) { - throw new SoftAssertionErrorWithObjectDetails(sae.getErrors(), annotatedObject); - } - } - - - private void addIfNotPresent( - @Nonnull final Collection collection, - @Nonnull final Annotation[] annotations) { - for (final Annotation annotation : annotations) { - if (!collection.contains(annotation)) { - collection.add(annotation); - } - } - } - - - private void checkForUndefinedMethodsInAnnotation( - @Nonnull final SoftAssertions softly, - @Nonnull final Annotation annotation, - @Nonnull final List validatedMethods) { - final Method[] allMethods = annotation.annotationType().getDeclaredMethods(); - - for (final Method declaredMethod : allMethods) { - // we do not want these to be checked - final boolean isBlacklisted = paramBlacklist.contains(declaredMethod.getName()); - // skip already validated methods - final boolean isAlreadyValidated = validatedMethods.contains(declaredMethod.getName()); - - if (isBlacklisted || isAlreadyValidated) { - continue; - } - - // all methods in current annotation which are not defined in annotation definition or blacklist are to be reported as error - final Object methodResult; - try { - methodResult = declaredMethod.invoke(annotation); - - if (validationMode != ValidationMode.EXACTLY) { - Object defaultValue = declaredMethod.getDefaultValue(); - - softly.assertThat(methodResult) - .as("Unexpected value for Method '%s' found.", declaredMethod.getName()) - .isEqualTo(defaultValue); - } else { - if (Object[].class.isInstance(methodResult)) { - softly.assertThat((Object[]) methodResult) - .as("Unexpected values for %s found.", declaredMethod.getName()).isNullOrEmpty(); - } else { - final String description = "Unexpected value for Method '%s' found."; - if (methodResult instanceof String) { - softly.assertThat((String) methodResult).as(description, declaredMethod.getName()) - .isNullOrEmpty(); - } else { - softly.assertThat(methodResult).as(description, declaredMethod.getName()).isNull(); - } - } - } - } catch (IllegalAccessException | InvocationTargetException e) { - softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, declaredMethod.getName())); - } - } - } - - - private boolean equalParamTypes( - @Nonnull final Class[] typesOne, - @Nonnull final Class[] typesTwo) { - if (typesOne.length == typesTwo.length) { - for (int i = 0; i < typesOne.length; i++) { - if (typesOne[i] != typesTwo[i]) { - return false; - } - } - return true; - } - return false; - } - - - /** - * Calls dependent on the type of the given Object: - */ - @Nonnull - private Optional findAnnotationFor( - @Nonnull final Class annotation) { - return Arrays.stream(allAnnotations) - .filter(annotationFound -> annotationFound.annotationType().getName().equals(annotation.getName())) - .findAny(); - } - - - /** - * Calls dependent on the type of the given Object: - */ - @Nullable - private Annotation[] getAllAnnotationsFor( - @Nonnull final Object annotated) { - if (annotated instanceof Field) { - return ((Field) annotated).getAnnotations(); - } - - if (annotated instanceof Constructor) { - return ((Constructor) annotated).getAnnotations(); - } - - if (annotated instanceof Method) { - final Method annotatedMethod = (Method) annotated; - final Class declaringClass = annotatedMethod.getDeclaringClass(); - final List> allClasses = new ArrayList<>(); - allClasses.add(declaringClass); - allClasses.addAll(ClassUtils.getAllSuperclasses(declaringClass)); - - final ArrayList allAnnotations = new ArrayList<>(); - - for (final Class aClass : allClasses) { - final ArrayList allMethods = new ArrayList<>(); - allMethods.addAll(Arrays.asList(aClass.getDeclaredMethods())); - - final List> interfaces = ClassUtils.getAllInterfaces(aClass); - - for (final Class anInterface : interfaces) { - allMethods.addAll(Arrays.asList(anInterface.getDeclaredMethods())); - } - - allMethods.stream() - .filter(method -> isSameMethod(method, annotatedMethod)) - .forEachOrdered(method -> addIfNotPresent(allAnnotations, method.getAnnotations())); - } - - return allAnnotations.toArray(new Annotation[]{}); - } - - final Class annotatedClass = (Class) annotated; - final List> allClasses = new ArrayList<>(); - allClasses.add(annotatedClass); - allClasses.addAll(ClassUtils.getAllSuperclasses(annotatedClass)); - - final ArrayList allAnnotations = new ArrayList<>(); - - for (final Class aClass : allClasses) { - addIfNotPresent(allAnnotations, aClass.getAnnotations()); - final List> interfaces = ClassUtils.getAllInterfaces(aClass); - for (final Class anInterface : interfaces) { - addIfNotPresent(allAnnotations, anInterface.getAnnotations()); - } - } - - return allAnnotations.toArray(new Annotation[]{}); - } - - - private boolean isSameMethod( - @Nonnull final Method one, - @Nonnull final Method two) { - return Objects.equals(one.getName(), two.getName()) && equalParamTypes(one.getParameterTypes(), - two.getParameterTypes()); - } - - - private List validateAllMethodsOfAnnotationDefinition( - @Nonnull final SoftAssertions softly, - @Nonnull final AnnotationDefinition annotationDefinition, - @Nonnull final Annotation annotation) { - final List validatedMethods = Lists.newArrayList(); - - // check all methods defined in annotation definition - for (final AnnotationDefinition.AnnotationMethodDefinition annotationMethodDefinition : annotationDefinition - .getAnnotationMethodDefinitions()) { - final String methodName = annotationMethodDefinition.getMethod(); - final Object[] expectedValues = annotationMethodDefinition.getValues(); - - Method actualMethod = null; - try { - actualMethod = annotation.annotationType().getMethod(methodName); - } catch (final NoSuchMethodException e) { - softly.assertThat(actualMethod).as("Method %s not found.", methodName).isNotNull(); - continue; - } - - // check if this annotation's actualMethod is an alias - Method aliasMethod = null; - Optional aliasForAnnotation = getAliasNameIfPresent(actualMethod); - if (aliasForAnnotation.isPresent()) { - try { - aliasMethod = getAliasMethod(annotation, aliasForAnnotation.get(), methodName); - } catch (NoSuchMethodException e) { - softly.assertThat(aliasMethod) - .as("Referenced alias method %s not found.", aliasForAnnotation.get()) - .isNotNull(); - continue; - } catch (IllegalAccessException | InvocationTargetException e) { - softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, actualMethod.getName())); - } - } - - - // check that actual actualMethod in annotation has defined return types - final Object actualMethodResult; - final Object aliasMethodResult; - Object assertableResult = null; - try { - actualMethodResult = actualMethod.invoke(annotation); - assertableResult = actualMethodResult; - - assertMethodResult(actualMethodResult, expectedValues); - } catch (IllegalAccessException | InvocationTargetException e) { - softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, actualMethod.getName())); - } catch (AssertionError e) { - if (aliasForAnnotation.isPresent()) { - try { - aliasMethodResult = aliasMethod.invoke(annotation); - - assertMethodResult(aliasMethodResult, expectedValues); - - assertableResult = aliasMethodResult; - } catch (IllegalAccessException | InvocationTargetException e1) { - softly.fail(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, aliasMethod.getName()); - } catch (AssertionError e1) { - // noop - } - } - } - - if (Object[].class.isInstance(assertableResult)) { - // this produces readable descriptions on its own - // all and only defined values must be returned in defined order - softly.assertThat((Object[]) assertableResult).containsExactlyElementsOf(Arrays.asList(expectedValues)); - } else { - // this produces readable descriptions on its own - softly.assertThat(assertableResult).isEqualTo(expectedValues[0]); - } - - validatedMethods.add(actualMethod.getName()); - if (aliasForAnnotation.isPresent()) { - validatedMethods.add(aliasMethod.getName()); - } - } - - return validatedMethods; - } - - - private Method getAliasMethod(Annotation originalAnnotation, Annotation aliasForAnnotation, String methodName) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - Method annotationMethod = aliasForAnnotation.annotationType().getDeclaredMethod("annotation"); - Class annotationValue = - (Class) annotationMethod.invoke(aliasForAnnotation); - - String aliasMethodName; - if (!annotationValue.equals(annotationMethod.getDefaultValue())) { - aliasMethodName = aliasForAnnotation - .annotationType() - .getDeclaredMethod("attribute") - .invoke(aliasForAnnotation) - .toString(); - - if (StringUtils.isEmpty(aliasMethodName)) { - aliasMethodName = methodName; - } - - return annotationValue.getDeclaredMethod(aliasMethodName); - } else { - aliasMethodName = aliasForAnnotation - .annotationType() - .getDeclaredMethod("value") - .invoke(aliasForAnnotation) - .toString(); - - return originalAnnotation.annotationType().getDeclaredMethod(aliasMethodName); - } - } - - - private void assertMethodResult(Object actualValues, Object[] expectedValues) { - if (Object[].class.isInstance(actualValues)) { - // this produces readable descriptions on its own - // all and only defined values must be returned in defined order - assertThat((Object[]) actualValues).containsExactlyElementsOf(Arrays.asList(expectedValues)); - } else { - // this produces readable descriptions on its own - assertThat(actualValues).isEqualTo(expectedValues[0]); - } - } - - - private Optional getAliasNameIfPresent(Method method) { - return Arrays.stream(method.getDeclaredAnnotations()) - .filter(annotationFound -> annotationFound.annotationType().getName().endsWith("AliasFor")) - .findAny(); - } - -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import org.apache.commons.lang3.ClassUtils; +import org.apache.commons.lang3.StringUtils; +import org.assertj.core.api.SoftAssertionError; +import org.assertj.core.api.SoftAssertions; +import org.assertj.core.util.Lists; +import org.assertj.core.util.VisibleForTesting; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; + +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * API for {@link AnnotationValidator} + */ +public class AnnotationValidation { + + @VisibleForTesting + HashSet paramBlacklist; + private List annotationDefinitions; + private ValidationMode validationMode; + private Annotation[] allAnnotations; + private static final String + ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE = "Could not access/invoke aliased method for '%s'."; + + + AnnotationValidation( + @Nonnull final HashSet parametersBlacklist) { + validationMode = ValidationMode.DEFAULT; + paramBlacklist = parametersBlacklist; + annotationDefinitions = new ArrayList<>(); + } + + + /** + * Adds an {@link AnnotationDefinition} to the Validator + * + * @param annotationDefinition the Annotation + * @return the AnnotationValidator + */ + @Nonnull + public AnnotationValidation annotation( + @Nonnull final AnnotationDefinition annotationDefinition) { + annotationDefinitions.add(annotationDefinition); + return this; + } + + + /** + * Validates that no other Annotations are defined and only the defined params are present. + * + * @return the AnnotationValidator + */ + @Nonnull + public AnnotationValidation exactly() { + validationMode = ValidationMode.EXACTLY; + return this; + } + + + /** + * Validates that no other Annotations are defined considering default values for undefined params. + * + * @return the AnnotationValidator + */ + @Nonnull + public AnnotationValidation only() { + validationMode = ValidationMode.ONLY; + return this; + } + + + /** + * Validates Annotations of the given Class and checks that: + *
- all given Annotations are found + *
- no other Annotations are on the given Class + *
- Annotations are in correct order + * + * @param annotatedClass Class to be validated + */ + public void forClass( + @Nonnull final Class annotatedClass) { + forClassOrMethodOrField(annotatedClass); + } + + + public void forConstructor(@Nonnull final Constructor annotatedContructor) { + forClassOrMethodOrField(annotatedContructor); + } + + + /** + * Validates Annotations of the given Method and checks that: + *
- all given Annotations are found + *
- no other Annotations are on the given Method + *
- Annotations are in correct order + * + * @param annotatedMethod Method to be validated + */ + public void forMethod( + @Nonnull final Method annotatedMethod) { + forClassOrMethodOrField(annotatedMethod); + } + + + /** + * Validates Annotations of the given Field and checks that: + *
- all given Annotations are found + *
- no other Annotations are on the given Filed + *
- Annotations are in correct order + * + * @param annotatedField Field to be validated + */ + public void forField( + @Nonnull final Field annotatedField) { + forClassOrMethodOrField(annotatedField); + } + + + /** + * Validates the configured Annotations + * + * @param annotatedObject can be a Class, a Method or a Field + */ + private void forClassOrMethodOrField( + @Nonnull final Object annotatedObject) { + final SoftAssertions softly = new SoftAssertions(); + final List annotationsList = new ArrayList<>(); + allAnnotations = getAllAnnotationsFor(annotatedObject); + + for (final AnnotationDefinition annotationDefinition : annotationDefinitions) { + // check if annotation is present + final Optional foundAnnotation = + findAnnotationFor(annotationDefinition.getAnnotation()); + + softly.assertThat(foundAnnotation) + .as("Expected Annotation %s not found", annotationDefinition.getAnnotation().getName()) + .isPresent(); + + foundAnnotation.ifPresent(annotation -> { + annotationsList.add(annotation.annotationType().getName()); + + // check all methods defined in annotation definition against current annotation's methods + final List validatedMethods = + validateAllMethodsOfAnnotationDefinition(softly, annotationDefinition, annotation); + + // check if there are undefined methods in annotation definition present in annotation + checkForUndefinedMethodsInAnnotation(softly, annotation, validatedMethods); + }); + } + + softly.assertThat(validationMode == ValidationMode.DEFAULT && annotationDefinitions.isEmpty()) + .as("Please add at least one Annotation to assert or enable strict validation.") + .isFalse(); + + if (validationMode != ValidationMode.DEFAULT) { + softly.assertThat(allAnnotations) + .extracting(annotation -> annotation.annotationType().getName()) + .containsExactlyElementsOf(annotationsList); + } + try { + softly.assertAll(); + } catch (final SoftAssertionError sae) { + throw new SoftAssertionErrorWithObjectDetails(sae.getErrors(), annotatedObject); + } + } + + + private void addIfNotPresent( + @Nonnull final Collection collection, + @Nonnull final Annotation[] annotations) { + for (final Annotation annotation : annotations) { + if (!collection.contains(annotation)) { + collection.add(annotation); + } + } + } + + + private void checkForUndefinedMethodsInAnnotation( + @Nonnull final SoftAssertions softly, + @Nonnull final Annotation annotation, + @Nonnull final List validatedMethods) { + final Method[] allMethods = annotation.annotationType().getDeclaredMethods(); + + for (final Method declaredMethod : allMethods) { + // we do not want these to be checked + final boolean isBlacklisted = paramBlacklist.contains(declaredMethod.getName()); + // skip already validated methods + final boolean isAlreadyValidated = validatedMethods.contains(declaredMethod.getName()); + + if (isBlacklisted || isAlreadyValidated) { + continue; + } + + // all methods in current annotation which are not defined in annotation definition or blacklist are to be reported as error + final Object methodResult; + try { + methodResult = declaredMethod.invoke(annotation); + + if (validationMode != ValidationMode.EXACTLY) { + Object defaultValue = declaredMethod.getDefaultValue(); + + softly.assertThat(methodResult) + .as("Unexpected value for Method '%s' found.", declaredMethod.getName()) + .isEqualTo(defaultValue); + } else { + if (Object[].class.isInstance(methodResult)) { + softly.assertThat((Object[]) methodResult) + .as("Unexpected values for %s found.", declaredMethod.getName()).isNullOrEmpty(); + } else { + final String description = "Unexpected value for Method '%s' found."; + if (methodResult instanceof String) { + softly.assertThat((String) methodResult).as(description, declaredMethod.getName()) + .isNullOrEmpty(); + } else { + softly.assertThat(methodResult).as(description, declaredMethod.getName()).isNull(); + } + } + } + } catch (IllegalAccessException | InvocationTargetException e) { + softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, declaredMethod.getName())); + } + } + } + + + private boolean equalParamTypes( + @Nonnull final Class[] typesOne, + @Nonnull final Class[] typesTwo) { + if (typesOne.length == typesTwo.length) { + for (int i = 0; i < typesOne.length; i++) { + if (typesOne[i] != typesTwo[i]) { + return false; + } + } + return true; + } + return false; + } + + + /** + * Calls dependent on the type of the given Object: + */ + @Nonnull + private Optional findAnnotationFor( + @Nonnull final Class annotation) { + return Arrays.stream(allAnnotations) + .filter(annotationFound -> annotationFound.annotationType().getName().equals(annotation.getName())) + .findAny(); + } + + + /** + * Calls dependent on the type of the given Object: + */ + @Nullable + private Annotation[] getAllAnnotationsFor( + @Nonnull final Object annotated) { + if (annotated instanceof Field) { + return ((Field) annotated).getAnnotations(); + } + + if (annotated instanceof Constructor) { + return ((Constructor) annotated).getAnnotations(); + } + + if (annotated instanceof Method) { + final Method annotatedMethod = (Method) annotated; + final Class declaringClass = annotatedMethod.getDeclaringClass(); + final List> allClasses = new ArrayList<>(); + allClasses.add(declaringClass); + allClasses.addAll(ClassUtils.getAllSuperclasses(declaringClass)); + + final ArrayList allAnnotations = new ArrayList<>(); + + for (final Class aClass : allClasses) { + final ArrayList allMethods = new ArrayList<>(); + allMethods.addAll(Arrays.asList(aClass.getDeclaredMethods())); + + final List> interfaces = ClassUtils.getAllInterfaces(aClass); + + for (final Class anInterface : interfaces) { + allMethods.addAll(Arrays.asList(anInterface.getDeclaredMethods())); + } + + allMethods.stream() + .filter(method -> isSameMethod(method, annotatedMethod)) + .forEachOrdered(method -> addIfNotPresent(allAnnotations, method.getAnnotations())); + } + + return allAnnotations.toArray(new Annotation[]{}); + } + + final Class annotatedClass = (Class) annotated; + final List> allClasses = new ArrayList<>(); + allClasses.add(annotatedClass); + allClasses.addAll(ClassUtils.getAllSuperclasses(annotatedClass)); + + final ArrayList allAnnotations = new ArrayList<>(); + + for (final Class aClass : allClasses) { + addIfNotPresent(allAnnotations, aClass.getAnnotations()); + final List> interfaces = ClassUtils.getAllInterfaces(aClass); + for (final Class anInterface : interfaces) { + addIfNotPresent(allAnnotations, anInterface.getAnnotations()); + } + } + + return allAnnotations.toArray(new Annotation[]{}); + } + + + private boolean isSameMethod( + @Nonnull final Method one, + @Nonnull final Method two) { + return Objects.equals(one.getName(), two.getName()) && equalParamTypes(one.getParameterTypes(), + two.getParameterTypes()); + } + + + private List validateAllMethodsOfAnnotationDefinition( + @Nonnull final SoftAssertions softly, + @Nonnull final AnnotationDefinition annotationDefinition, + @Nonnull final Annotation annotation) { + final List validatedMethods = Lists.newArrayList(); + + // check all methods defined in annotation definition + for (final AnnotationDefinition.AnnotationMethodDefinition annotationMethodDefinition : annotationDefinition + .getAnnotationMethodDefinitions()) { + final String methodName = annotationMethodDefinition.getMethod(); + final Object[] expectedValues = annotationMethodDefinition.getValues(); + + Method actualMethod = null; + try { + actualMethod = annotation.annotationType().getMethod(methodName); + } catch (final NoSuchMethodException e) { + softly.assertThat(actualMethod).as("Method %s not found.", methodName).isNotNull(); + continue; + } + + // check if this annotation's actualMethod is an alias + Method aliasMethod = null; + Optional aliasForAnnotation = getAliasNameIfPresent(actualMethod); + if (aliasForAnnotation.isPresent()) { + try { + aliasMethod = getAliasMethod(annotation, aliasForAnnotation.get(), methodName); + } catch (NoSuchMethodException e) { + softly.assertThat(aliasMethod) + .as("Referenced alias method %s not found.", aliasForAnnotation.get()) + .isNotNull(); + continue; + } catch (IllegalAccessException | InvocationTargetException e) { + softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, actualMethod.getName())); + } + } + + + // check that actual actualMethod in annotation has defined return types + final Object actualMethodResult; + final Object aliasMethodResult; + Object assertableResult = null; + try { + actualMethodResult = actualMethod.invoke(annotation); + assertableResult = actualMethodResult; + + assertMethodResult(actualMethodResult, expectedValues); + } catch (IllegalAccessException | InvocationTargetException e) { + softly.fail(format(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, actualMethod.getName())); + } catch (AssertionError e) { + if (aliasForAnnotation.isPresent()) { + try { + aliasMethodResult = aliasMethod.invoke(annotation); + + assertMethodResult(aliasMethodResult, expectedValues); + + assertableResult = aliasMethodResult; + } catch (IllegalAccessException | InvocationTargetException e1) { + softly.fail(ACCESS_OR_INVOCATION_EXCEPTION_MESSAGE, aliasMethod.getName()); + } catch (AssertionError e1) { + // noop + } + } + } + + if (Object[].class.isInstance(assertableResult)) { + // this produces readable descriptions on its own + // all and only defined values must be returned in defined order + softly.assertThat((Object[]) assertableResult).containsExactlyElementsOf(Arrays.asList(expectedValues)); + } else { + // this produces readable descriptions on its own + softly.assertThat(assertableResult).isEqualTo(expectedValues[0]); + } + + validatedMethods.add(actualMethod.getName()); + if (aliasForAnnotation.isPresent()) { + validatedMethods.add(aliasMethod.getName()); + } + } + + return validatedMethods; + } + + + private Method getAliasMethod(Annotation originalAnnotation, Annotation aliasForAnnotation, String methodName) + throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + Method annotationMethod = aliasForAnnotation.annotationType().getDeclaredMethod("annotation"); + Class annotationValue = + (Class) annotationMethod.invoke(aliasForAnnotation); + + String aliasMethodName; + if (!annotationValue.equals(annotationMethod.getDefaultValue())) { + aliasMethodName = aliasForAnnotation + .annotationType() + .getDeclaredMethod("attribute") + .invoke(aliasForAnnotation) + .toString(); + + if (StringUtils.isEmpty(aliasMethodName)) { + aliasMethodName = methodName; + } + + return annotationValue.getDeclaredMethod(aliasMethodName); + } else { + aliasMethodName = aliasForAnnotation + .annotationType() + .getDeclaredMethod("value") + .invoke(aliasForAnnotation) + .toString(); + + return originalAnnotation.annotationType().getDeclaredMethod(aliasMethodName); + } + } + + + private void assertMethodResult(Object actualValues, Object[] expectedValues) { + if (Object[].class.isInstance(actualValues)) { + // this produces readable descriptions on its own + // all and only defined values must be returned in defined order + assertThat((Object[]) actualValues).containsExactlyElementsOf(Arrays.asList(expectedValues)); + } else { + // this produces readable descriptions on its own + assertThat(actualValues).isEqualTo(expectedValues[0]); + } + } + + + private Optional getAliasNameIfPresent(Method method) { + return Arrays.stream(method.getDeclaredAnnotations()) + .filter(annotationFound -> annotationFound.annotationType().getName().endsWith("AliasFor")) + .findAny(); + } + +} diff --git a/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java b/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java index 8be769d..f78e58f 100644 --- a/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java +++ b/src/main/java/de/jakop/validation/annotations/AnnotationValidator.java @@ -1,51 +1,51 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import java.util.HashSet; - -import javax.annotation.Nonnull; - -/** - * Annotation Validation - */ -public class AnnotationValidator { - - private AnnotationValidator() { - // only via factory method - } - - /** - * Returns an AnnotationValidation - *
- uses SoftAssertions - *
- validates all given parameters for an Annotation and fails if there are differences - *
- respects parameter aliases - * - * @return ClassAnnotationValidator to validate for a specific Class - */ - @Nonnull - public static AnnotationValidation validate() { - final HashSet paramBlacklist = new HashSet<>(); - paramBlacklist.add("equals"); - paramBlacklist.add("toString"); - paramBlacklist.add("hashCode"); - paramBlacklist.add("annotationType"); - - return new AnnotationValidation(paramBlacklist); - } -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import java.util.HashSet; + +import javax.annotation.Nonnull; + +/** + * Annotation Validation + */ +public class AnnotationValidator { + + private AnnotationValidator() { + // only via factory method + } + + /** + * Returns an AnnotationValidation + *
- uses SoftAssertions + *
- validates all given parameters for an Annotation and fails if there are differences + *
- respects parameter aliases + * + * @return ClassAnnotationValidator to validate for a specific Class + */ + @Nonnull + public static AnnotationValidation validate() { + final HashSet paramBlacklist = new HashSet<>(); + paramBlacklist.add("equals"); + paramBlacklist.add("toString"); + paramBlacklist.add("hashCode"); + paramBlacklist.add("annotationType"); + + return new AnnotationValidation(paramBlacklist); + } +} diff --git a/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java b/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java index 7c7b0d6..6293ad1 100644 --- a/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java +++ b/src/main/java/de/jakop/validation/annotations/SoftAssertionErrorWithObjectDetails.java @@ -1,41 +1,41 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -/* - * (c) tolina GmbH, 2017 - */ -package de.jakop.validation.annotations; - -import java.util.List; - -import org.assertj.core.api.SoftAssertionError; - -final class SoftAssertionErrorWithObjectDetails extends SoftAssertionError { - private static final long serialVersionUID = 5527685338875086360L; - private final String annotatedObject; - - SoftAssertionErrorWithObjectDetails(final List errors, final Object annotatedObject) { - super(errors); - this.annotatedObject = annotatedObject.toString(); - } - - // if you are in a test loop and do not know witch object is under test, let's add this information to errormessage - @Override - public String getMessage() { - return "\nError on Validating " + annotatedObject + "\n" + super.getMessage(); - } -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +/* + * (c) tolina GmbH, 2017 + */ +package de.jakop.validation.annotations; + +import java.util.List; + +import org.assertj.core.api.SoftAssertionError; + +final class SoftAssertionErrorWithObjectDetails extends SoftAssertionError { + private static final long serialVersionUID = 5527685338875086360L; + private final String annotatedObject; + + SoftAssertionErrorWithObjectDetails(final List errors, final Object annotatedObject) { + super(errors); + this.annotatedObject = annotatedObject.toString(); + } + + // if you are in a test loop and do not know witch object is under test, let's add this information to errormessage + @Override + public String getMessage() { + return "\nError on Validating " + annotatedObject + "\n" + super.getMessage(); + } +} diff --git a/src/main/java/de/jakop/validation/annotations/ValidationMode.java b/src/main/java/de/jakop/validation/annotations/ValidationMode.java index cfa7b86..3ddb87d 100644 --- a/src/main/java/de/jakop/validation/annotations/ValidationMode.java +++ b/src/main/java/de/jakop/validation/annotations/ValidationMode.java @@ -1,22 +1,22 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -public enum ValidationMode { - DEFAULT, ONLY, EXACTLY -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +public enum ValidationMode { + DEFAULT, ONLY, EXACTLY +} diff --git a/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java b/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java index 13486dc..27130fb 100644 --- a/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AliasTestAnnotation.java @@ -1,35 +1,35 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import org.springframework.core.annotation.AliasFor; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -@AnotherTestAnnotation -public @interface AliasTestAnnotation { - @AliasFor(annotation = AnotherTestAnnotation.class, attribute = "testEnum") - TestEnum referencedTestEnum() default TestEnum.TEST; - - @AliasFor(annotation = AnotherTestAnnotation.class) - TestEnum anotherValue() default TestEnum.TEST2; -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import org.springframework.core.annotation.AliasFor; + +import java.lang.annotation.Retention; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +@AnotherTestAnnotation +public @interface AliasTestAnnotation { + @AliasFor(annotation = AnotherTestAnnotation.class, attribute = "testEnum") + TestEnum referencedTestEnum() default TestEnum.TEST; + + @AliasFor(annotation = AnotherTestAnnotation.class) + TestEnum anotherValue() default TestEnum.TEST2; +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java index fb7507a..2f4a63d 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClass.java @@ -1,33 +1,33 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -@AnnotatedAbstractTestClassAnnotation -@SuppressWarnings("javadoc") -abstract class AnnotatedAbstractTestClass implements AnnotatedTestInterface, AnnotatedTestInterfaceForAbstractClass { - @AnnotatedAbstractTestClassAnnotation - protected abstract void annotatedAbstractMethod(); - - protected void annotatedAbstractMethod(final String param) { - - }; - - protected String annotatedAbstractMethod(final Object param) { - return ""; - }; -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +@AnnotatedAbstractTestClassAnnotation +@SuppressWarnings("javadoc") +abstract class AnnotatedAbstractTestClass implements AnnotatedTestInterface, AnnotatedTestInterfaceForAbstractClass { + @AnnotatedAbstractTestClassAnnotation + protected abstract void annotatedAbstractMethod(); + + protected void annotatedAbstractMethod(final String param) { + + }; + + protected String annotatedAbstractMethod(final Object param) { + return ""; + }; +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java index 7865c89..17e50eb 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedAbstractTestClassAnnotation.java @@ -1,27 +1,27 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -@interface AnnotatedAbstractTestClassAnnotation { -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +@interface AnnotatedAbstractTestClassAnnotation { +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java index 64b9c22..343d4d1 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestClass.java @@ -1,75 +1,75 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import static de.jakop.validation.annotations.TestEnum.TEST; -import static de.jakop.validation.annotations.TestEnum.TEST2; - -@TestAnnotation -@SuppressWarnings("javadoc") -class AnnotatedTestClass extends AnnotatedAbstractTestClass implements AnnotatedTestInterface { - - @TestAnnotation(testparameter = "testvalue") - private String fieldWithAnnotations; - - String fieldWithoutAnnotations; - - @TestAnnotation(testparameter = "testvalue", anotherTestParameter = "anotherTestValue") - @AnotherTestAnnotation(TEST2) - public void methodWithAnnotations() { - // noop - } - - @AliasTestAnnotation(referencedTestEnum = TEST2) - public void methodWithAliasAnnotations() { - // noop - } - - @AliasTestAnnotation(anotherValue = TEST) - public void methodWithAnOtherAliasAnnotations() { - // noop - } - - public void methodWithoutAnnotations() { - // noop - } - - @Override - public void annotatedInterfaceMethod() { - // noop - } - - @Override - public void annotatedInterfaceMethodForAbstractClass() { - // noop - } - - @Override - protected void annotatedAbstractMethod() { - // noop - } - - @AnotherTestAnnotation(TEST) - public void overloadedMethod(final String foo, final String bar) { - // noop - } - - public void overloadedMethod(final String foo, final int bar) { - // noop - } -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; + +@TestAnnotation +@SuppressWarnings("javadoc") +class AnnotatedTestClass extends AnnotatedAbstractTestClass implements AnnotatedTestInterface { + + @TestAnnotation(testparameter = "testvalue") + private String fieldWithAnnotations; + + String fieldWithoutAnnotations; + + @TestAnnotation(testparameter = "testvalue", anotherTestParameter = "anotherTestValue") + @AnotherTestAnnotation(TEST2) + public void methodWithAnnotations() { + // noop + } + + @AliasTestAnnotation(referencedTestEnum = TEST2) + public void methodWithAliasAnnotations() { + // noop + } + + @AliasTestAnnotation(anotherValue = TEST) + public void methodWithAnOtherAliasAnnotations() { + // noop + } + + public void methodWithoutAnnotations() { + // noop + } + + @Override + public void annotatedInterfaceMethod() { + // noop + } + + @Override + public void annotatedInterfaceMethodForAbstractClass() { + // noop + } + + @Override + protected void annotatedAbstractMethod() { + // noop + } + + @AnotherTestAnnotation(TEST) + public void overloadedMethod(final String foo, final String bar) { + // noop + } + + public void overloadedMethod(final String foo, final int bar) { + // noop + } +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java index 9443ad3..d60607a 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterface.java @@ -1,25 +1,25 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -@AnnotatedTestInterfaceAnnotation -@SuppressWarnings("javadoc") -interface AnnotatedTestInterface { - @AnnotatedTestInterfaceAnnotation - void annotatedInterfaceMethod(); -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +@AnnotatedTestInterfaceAnnotation +@SuppressWarnings("javadoc") +interface AnnotatedTestInterface { + @AnnotatedTestInterfaceAnnotation + void annotatedInterfaceMethod(); +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java index a5b9177..1f9b160 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceAnnotation.java @@ -1,27 +1,27 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -@interface AnnotatedTestInterfaceAnnotation { -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +@interface AnnotatedTestInterfaceAnnotation { +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java index a57619d..020304c 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClass.java @@ -1,25 +1,25 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -@AnnotatedTestInterfaceForAbstractClassAnnotation -@SuppressWarnings("javadoc") -interface AnnotatedTestInterfaceForAbstractClass { - @AnnotatedTestInterfaceForAbstractClassAnnotation - void annotatedInterfaceMethodForAbstractClass(); -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +@AnnotatedTestInterfaceForAbstractClassAnnotation +@SuppressWarnings("javadoc") +interface AnnotatedTestInterfaceForAbstractClass { + @AnnotatedTestInterfaceForAbstractClassAnnotation + void annotatedInterfaceMethodForAbstractClass(); +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java index 006f102..9e369bf 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotatedTestInterfaceForAbstractClassAnnotation.java @@ -1,27 +1,27 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -@interface AnnotatedTestInterfaceForAbstractClassAnnotation { -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +@interface AnnotatedTestInterfaceForAbstractClassAnnotation { +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java index 436ba8b..f48dce2 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotationValidationTest.java @@ -1,266 +1,266 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import java.lang.reflect.Method; - -import static de.jakop.validation.annotations.TestEnum.TEST; -import static de.jakop.validation.annotations.TestEnum.TEST2; - -/** - * Test for the {@link AnnotationValidator} - */ -public class AnnotationValidationTest { - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - - @Test - public void testValidateAnnotatedClass_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("testparameter", "default") // - .param("anotherTestParameter", "one", "two")) // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // - .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // - .forClass(AnnotatedTestClass.class); - } - - @Test - public void testValidateAnnotatedClass_only_defaultsAreEvaluated() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(TestAnnotation.class)) // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // - .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // - .forClass(AnnotatedTestClass.class); - } - - - @Test - public void testValidateAnnotatedClass_NotExactlyAndNoAnnotationsValidated() throws NoSuchMethodException { - thrown.expect(AssertionError.class); - thrown.expectMessage("Please add at least one Annotation to assert or enable strict validation."); - AnnotationValidator.validate() // - .forClass(AnnotatedTestClass.class); - } - - - @Test - public void testValidateAnnotatedClass_NotExactly() throws NoSuchMethodException { - AnnotationValidator.validate() // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // - .forClass(AnnotatedTestClass.class); - } - - - @Test - public void testValidateAnnotatedClass_NoSuchAnnotationMethod() throws NoSuchMethodException { - thrown.expect(AssertionError.class); - thrown.expectMessage("Method noSuchMethod not found"); - - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("noSuchMethod", "default")) // - .forClass(AnnotatedTestClass.class); - } - - - @Test - public void testValidateAnnotatedMethod_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("testparameter", "testvalue") // - .param("anotherTestParameter", "anotherTestValue")) // - .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // - .param("testEnum", TEST2)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); - } - - - @Test - public void testValidateAnnotatedMethod_only_defaultsAreEvaluated() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("testparameter", "testvalue") // - .param("anotherTestParameter", "anotherTestValue")) // - .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // - .param("testEnum", TEST2)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); - } - - - @Test - public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotationDefinition() - throws NoSuchMethodException { - thrown.expect(AssertionError.class); - thrown.expectMessage("Unexpected value for Method 'testparameter' found"); - - AnnotationValidator.validate() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("anotherTestParameter", "anotherTestValue")) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); - } - - - @Test - public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotationDefinition_NonStringValues() - throws NoSuchMethodException { - AnnotationValidator.validate() // - .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class).param("value", TEST2)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); - } - - - @Test - public void testValidateAnnotatedMethod_OverloadedMethod() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // - .param("testEnum", TEST) // - .param("value", TEST)) // - .forMethod(AnnotatedTestClass.class.getMethod("overloadedMethod", String.class, String.class)); - } - - - @Test - public void testValidateAnnotatedMethod_UseAlias() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // - .param("referencedTestEnum", TEST2)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAliasAnnotations")); - } - - - @Test - public void testValidateAnnotatedMethod_UseAlias_WithoutAttribute() throws NoSuchMethodException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // - .param("anotherValue", TEST)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnOtherAliasAnnotations")); - } - - - @Test - public void testValidateAnnotatedInterfaceMethod() throws NoSuchMethodException { - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // - .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethod")); - } - - - @Test - public void testValidateAnnotatedInterfaceMethodFromSuperclass() throws NoSuchMethodException { - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // - .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethodForAbstractClass")); - } - - - @Test - public void testValidateAnnotatedAbstractMethodFromSuperclass() throws NoSuchMethodException { - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // - .forMethod(AnnotatedTestClass.class.getDeclaredMethod("annotatedAbstractMethod")); - } - - - @Test - public void testValidateAnnotatedField_exactly_defaultsAreNotEvaluated() throws NoSuchFieldException { - AnnotationValidator.validate().exactly() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("testparameter", "testvalue") - .param("anotherTestParameter", "one", "two")) // - .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); - } - - - @Test - public void testValidateAnnotatedField_only_defaultsAreEvaluated() throws NoSuchFieldException { - AnnotationValidator.validate().only() // - .annotation(AnnotationDefinition.type(TestAnnotation.class) // - .param("testparameter", "testvalue")) // - .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); - } - - - @Test - public void testValidateMethod() throws NoSuchMethodException { - AnnotationValidator.validate().exactly()// - .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); - } - - - @Test - public void testValidateMethod_AnnotationNotPresent() throws NoSuchMethodException { - thrown.expect(AssertionError.class); - thrown.expectMessage("Expected Annotation de.jakop.validation.annotations.TestAnnotation not found"); - AnnotationValidator.validate().exactly()// - .annotation(AnnotationDefinition.type(TestAnnotation.class)) // - .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); - } - - - @Test - public void testValidateMethod_NoSuchMethod() throws NoSuchMethodException { - thrown.expect(NoSuchMethodException.class); - AnnotationValidator.validate().exactly()// - .forMethod(AnnotatedTestClass.class.getMethod("noSuchMethod")); - } - - - @Test - public void testValidateField() throws NoSuchFieldException { - AnnotationValidator.validate().exactly().forField(AnnotatedTestClass.class.getDeclaredField("fieldWithoutAnnotations")); - } - - - @Test - public void testValidateLambdas() throws Exception { - TestInterface test1 = TestInterface::staticMethod; - Method annotatedMethod1 = test1.getClass().getMethod("method"); - AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod1); - - TestInterface test2 = test1::defaultMethod; - Method annotatedMethod2 = test2.getClass().getMethod("defaultMethod"); - AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod2); - } - - - interface TestInterface { - - @Deprecated - static void staticMethod() { - System.out.println("staticMethod"); - } - - @Deprecated - void method(); - - @Deprecated - default void defaultMethod() { - System.out.println("defaultMethod"); - - } - } -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.lang.reflect.Method; + +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; + +/** + * Test for the {@link AnnotationValidator} + */ +public class AnnotationValidationTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + + @Test + public void testValidateAnnotatedClass_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("testparameter", "default") // + .param("anotherTestParameter", "one", "two")) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // + .forClass(AnnotatedTestClass.class); + } + + @Test + public void testValidateAnnotatedClass_only_defaultsAreEvaluated() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // + .forClass(AnnotatedTestClass.class); + } + + + @Test + public void testValidateAnnotatedClass_NotExactlyAndNoAnnotationsValidated() throws NoSuchMethodException { + thrown.expect(AssertionError.class); + thrown.expectMessage("Please add at least one Annotation to assert or enable strict validation."); + AnnotationValidator.validate() // + .forClass(AnnotatedTestClass.class); + } + + + @Test + public void testValidateAnnotatedClass_NotExactly() throws NoSuchMethodException { + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .forClass(AnnotatedTestClass.class); + } + + + @Test + public void testValidateAnnotatedClass_NoSuchAnnotationMethod() throws NoSuchMethodException { + thrown.expect(AssertionError.class); + thrown.expectMessage("Method noSuchMethod not found"); + + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("noSuchMethod", "default")) // + .forClass(AnnotatedTestClass.class); + } + + + @Test + public void testValidateAnnotatedMethod_exactly_defaultsAreNotEvaluated() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("testparameter", "testvalue") // + .param("anotherTestParameter", "anotherTestValue")) // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // + .param("testEnum", TEST2)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); + } + + + @Test + public void testValidateAnnotatedMethod_only_defaultsAreEvaluated() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("testparameter", "testvalue") // + .param("anotherTestParameter", "anotherTestValue")) // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // + .param("testEnum", TEST2)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); + } + + + @Test + public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotationDefinition() + throws NoSuchMethodException { + thrown.expect(AssertionError.class); + thrown.expectMessage("Unexpected value for Method 'testparameter' found"); + + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("anotherTestParameter", "anotherTestValue")) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); + } + + + @Test + public void testValidateAnnotatedMethod_NotAllAnnotationMethodsDefinedInAnnotationDefinition_NonStringValues() + throws NoSuchMethodException { + AnnotationValidator.validate() // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class).param("value", TEST2)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnnotations")); + } + + + @Test + public void testValidateAnnotatedMethod_OverloadedMethod() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AnotherTestAnnotation.class) // + .param("testEnum", TEST) // + .param("value", TEST)) // + .forMethod(AnnotatedTestClass.class.getMethod("overloadedMethod", String.class, String.class)); + } + + + @Test + public void testValidateAnnotatedMethod_UseAlias() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // + .param("referencedTestEnum", TEST2)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAliasAnnotations")); + } + + + @Test + public void testValidateAnnotatedMethod_UseAlias_WithoutAttribute() throws NoSuchMethodException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(AliasTestAnnotation.class) // + .param("anotherValue", TEST)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithAnOtherAliasAnnotations")); + } + + + @Test + public void testValidateAnnotatedInterfaceMethod() throws NoSuchMethodException { + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceAnnotation.class)) // + .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethod")); + } + + + @Test + public void testValidateAnnotatedInterfaceMethodFromSuperclass() throws NoSuchMethodException { + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedTestInterfaceForAbstractClassAnnotation.class)) // + .forMethod(AnnotatedTestClass.class.getMethod("annotatedInterfaceMethodForAbstractClass")); + } + + + @Test + public void testValidateAnnotatedAbstractMethodFromSuperclass() throws NoSuchMethodException { + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(AnnotatedAbstractTestClassAnnotation.class)) // + .forMethod(AnnotatedTestClass.class.getDeclaredMethod("annotatedAbstractMethod")); + } + + + @Test + public void testValidateAnnotatedField_exactly_defaultsAreNotEvaluated() throws NoSuchFieldException { + AnnotationValidator.validate().exactly() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("testparameter", "testvalue") + .param("anotherTestParameter", "one", "two")) // + .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); + } + + + @Test + public void testValidateAnnotatedField_only_defaultsAreEvaluated() throws NoSuchFieldException { + AnnotationValidator.validate().only() // + .annotation(AnnotationDefinition.type(TestAnnotation.class) // + .param("testparameter", "testvalue")) // + .forField(AnnotatedTestClass.class.getDeclaredField("fieldWithAnnotations")); + } + + + @Test + public void testValidateMethod() throws NoSuchMethodException { + AnnotationValidator.validate().exactly()// + .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); + } + + + @Test + public void testValidateMethod_AnnotationNotPresent() throws NoSuchMethodException { + thrown.expect(AssertionError.class); + thrown.expectMessage("Expected Annotation de.jakop.validation.annotations.TestAnnotation not found"); + AnnotationValidator.validate().exactly()// + .annotation(AnnotationDefinition.type(TestAnnotation.class)) // + .forMethod(AnnotatedTestClass.class.getMethod("methodWithoutAnnotations")); + } + + + @Test + public void testValidateMethod_NoSuchMethod() throws NoSuchMethodException { + thrown.expect(NoSuchMethodException.class); + AnnotationValidator.validate().exactly()// + .forMethod(AnnotatedTestClass.class.getMethod("noSuchMethod")); + } + + + @Test + public void testValidateField() throws NoSuchFieldException { + AnnotationValidator.validate().exactly().forField(AnnotatedTestClass.class.getDeclaredField("fieldWithoutAnnotations")); + } + + + @Test + public void testValidateLambdas() throws Exception { + TestInterface test1 = TestInterface::staticMethod; + Method annotatedMethod1 = test1.getClass().getMethod("method"); + AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod1); + + TestInterface test2 = test1::defaultMethod; + Method annotatedMethod2 = test2.getClass().getMethod("defaultMethod"); + AnnotationValidator.validate().annotation(AnnotationDefinition.type(Deprecated.class)).forMethod(annotatedMethod2); + } + + + interface TestInterface { + + @Deprecated + static void staticMethod() { + System.out.println("staticMethod"); + } + + @Deprecated + void method(); + + @Deprecated + default void defaultMethod() { + System.out.println("defaultMethod"); + + } + } +} diff --git a/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java b/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java index ebb40e6..c278cb4 100644 --- a/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java +++ b/src/test/java/de/jakop/validation/annotations/AnnotationValidatorTest.java @@ -1,32 +1,32 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import org.hamcrest.CoreMatchers; -import org.junit.Test; - -import static org.junit.Assert.assertThat; - -public class AnnotationValidatorTest { - @Test - public void testValidate_DefaultBlacklist() { - final AnnotationValidation validate = AnnotationValidator.validate(); - assertThat(validate.paramBlacklist, CoreMatchers.hasItems("equals", "toString", "hashCode", "annotationType")); - } - -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import org.hamcrest.CoreMatchers; +import org.junit.Test; + +import static org.junit.Assert.assertThat; + +public class AnnotationValidatorTest { + @Test + public void testValidate_DefaultBlacklist() { + final AnnotationValidation validate = AnnotationValidator.validate(); + assertThat(validate.paramBlacklist, CoreMatchers.hasItems("equals", "toString", "hashCode", "annotationType")); + } + +} diff --git a/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java b/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java index 6bb0d05..ee59645 100644 --- a/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/AnotherTestAnnotation.java @@ -1,39 +1,39 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import org.springframework.core.annotation.AliasFor; - -import java.lang.annotation.Retention; - -import static de.jakop.validation.annotations.TestEnum.TEST; -import static de.jakop.validation.annotations.TestEnum.TEST2; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -public @interface AnotherTestAnnotation { - - @AliasFor("testEnum") - TestEnum value() default TEST; - - @AliasFor("value") - TestEnum testEnum() default TEST; - - TestEnum anotherValue() default TEST2; -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import org.springframework.core.annotation.AliasFor; + +import java.lang.annotation.Retention; + +import static de.jakop.validation.annotations.TestEnum.TEST; +import static de.jakop.validation.annotations.TestEnum.TEST2; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +public @interface AnotherTestAnnotation { + + @AliasFor("testEnum") + TestEnum value() default TEST; + + @AliasFor("value") + TestEnum testEnum() default TEST; + + TestEnum anotherValue() default TEST2; +} diff --git a/src/test/java/de/jakop/validation/annotations/TestAnnotation.java b/src/test/java/de/jakop/validation/annotations/TestAnnotation.java index 3330bbc..965bf10 100644 --- a/src/test/java/de/jakop/validation/annotations/TestAnnotation.java +++ b/src/test/java/de/jakop/validation/annotations/TestAnnotation.java @@ -1,30 +1,30 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; - -@Retention(RUNTIME) -@SuppressWarnings("javadoc") -public @interface TestAnnotation { - String testparameter() default "default"; - - String[] anotherTestParameter() default { "one", "two" }; -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; + +@Retention(RUNTIME) +@SuppressWarnings("javadoc") +public @interface TestAnnotation { + String testparameter() default "default"; + + String[] anotherTestParameter() default { "one", "two" }; +} diff --git a/src/test/java/de/jakop/validation/annotations/TestEnum.java b/src/test/java/de/jakop/validation/annotations/TestEnum.java index 65c6714..9414aa7 100644 --- a/src/test/java/de/jakop/validation/annotations/TestEnum.java +++ b/src/test/java/de/jakop/validation/annotations/TestEnum.java @@ -1,23 +1,23 @@ -/** - * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Modifications copyright (C) 2020 Frank Jakop - */ -package de.jakop.validation.annotations; - -@SuppressWarnings("javadoc") -public enum TestEnum { - TEST, TEST2 -} +/** + * Copyright © 2016 arxes-tolina GmbH (entwicklung@arxes-tolina.de) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Modifications copyright (C) 2020 Frank Jakop + */ +package de.jakop.validation.annotations; + +@SuppressWarnings("javadoc") +public enum TestEnum { + TEST, TEST2 +} From a49140bc80833ff40cd67c60f8e0bbd3a29391e8 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Tue, 8 Sep 2020 14:30:20 +0200 Subject: [PATCH 18/30] Release 2.0.1 --- CHANGELOG.md | 1 + pom.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07dfcc6..ce26b07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +## [2.0.1] - 2020-09-09 ### Changed - Moved to new coordinates de.jakop.validation:annotation-validator - Multiple dependencies updated diff --git a/pom.xml b/pom.xml index d64b9a6..d093b7c 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ de.jakop.validation annotation-validator - 2.0.1-SNAPSHOT + 2.0.1 jar Annotation Validator From 89159bc762cb36d27f383c9377339f31b7b85868 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:00:35 +0200 Subject: [PATCH 19/30] chore(deps): update assertj-core to 3.20.2 --- CHANGELOG.md | 4 ++++ pom.xml | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce26b07..9143f89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.0.2] - 2021-09-02 +### Changed +- Multiple dependencies updated + ## [2.0.1] - 2020-09-09 ### Changed - Moved to new coordinates de.jakop.validation:annotation-validator diff --git a/pom.xml b/pom.xml index d093b7c..57f8285 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ de.jakop.validation annotation-validator - 2.0.1 + 2.0.2-SNAPSHOT jar Annotation Validator @@ -86,13 +86,13 @@ org.assertj assertj-core - 3.17.2 + 3.20.2 org.apache.commons commons-lang3 - 3.11 + 3.12.0 @@ -104,7 +104,7 @@ junit junit - 4.13 + 4.13.2 test @@ -117,7 +117,7 @@ org.springframework spring-core - 5.2.8.RELEASE + 5.3.9 test From 77507e9e2d6702e2f1cefcf1475e64f3e146fa3a Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:06:26 +0200 Subject: [PATCH 20/30] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 39b5d1a..b1766a2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -25,12 +25,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 1.8, 11, 12, 13 ] + java: [ 8, 11, 12, 13 ] name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 - name: Set up Java - uses: actions/setup-java@v1 + uses: actions/setup-java@v2.3.0 with: java-version: ${{ matrix.java }} - name: Build with Maven From 2e5fb0d544bf9313bd2e6dc26bba50051ad7f9d2 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:09:09 +0200 Subject: [PATCH 21/30] Update maven.yml --- .github/workflows/maven.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b1766a2..0f44d9a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 8, 11, 12, 13 ] + java: [ 1.8, 11, 12, 13 ] name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 @@ -33,6 +33,7 @@ jobs: uses: actions/setup-java@v2.3.0 with: java-version: ${{ matrix.java }} + distribution: jdk - name: Build with Maven run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: From 0772f82be35fd57272a2637f8195a79318e61d62 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:11:32 +0200 Subject: [PATCH 22/30] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0f44d9a..49f0d36 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 1.8, 11, 12, 13 ] + java: [ 8, 11, 16 ] name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 @@ -33,7 +33,7 @@ jobs: uses: actions/setup-java@v2.3.0 with: java-version: ${{ matrix.java }} - distribution: jdk + distribution: adopt - name: Build with Maven run: mvn -B package sonar:sonar -Pcoverage-per-test --file pom.xml env: From 6441fd153374355d39d72f2aa37c09c75eb92364 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:13:30 +0200 Subject: [PATCH 23/30] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 49f0d36..8e10327 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 8, 11, 16 ] + java: [ 8, 11 ] name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 From e032ecd36c3741ecefc2ec2079b0f9595ac18068 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:19:18 +0200 Subject: [PATCH 24/30] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8e10327..e47338e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 8, 11 ] + java: [ 11 ] name: Test with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 From 0b051c292910cbc96152800574b9497da6f2d058 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:23:11 +0200 Subject: [PATCH 25/30] docs: update assertj-core to 3.20.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b3430a..41ec095 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Add the following dependency to your pom.xml de.jakop.validation annotation-validator - 1.0 + 2.0.2 test ``` From 8a4949a2cd922e59c8a36f330000cef621d42856 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:23:44 +0200 Subject: [PATCH 26/30] [maven-release-plugin] prepare release annotation-validator-2.0.2 --- pom.xml | 677 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 338 insertions(+), 339 deletions(-) diff --git a/pom.xml b/pom.xml index 57f8285..8aad420 100644 --- a/pom.xml +++ b/pom.xml @@ -1,339 +1,338 @@ - - - - 4.0.0 - - de.jakop.validation - annotation-validator - 2.0.2-SNAPSHOT - jar - - Annotation Validator - - - Check classes, methods or fields for annotations with specific parameters. - - - 2020 - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Frank Jakop - - - - http://github.com/fjakop/annotation-validator - - - scm:git:ssh://git@github.com/fjakop/annotation-validator.git - scm:git:ssh://git@github.com/fjakop/annotation-validator.git - https://github.com/fjakop/annotation-validator - - - - - UTF-8 - 1.8 - ${java.version} - ${java.version} - - 0.8.5 - 3.0 - 3.0.0-M3 - 1.6 - 3.2.0 - 3.2.0 - 0.4 - 3.0.0-M1 - 3.2.1 - 1.6.8 - 3.0.0-M5 - 5.14.0.18788 - - fjakop_annotation-validator - fjakop-github - https://sonarcloud.io - - - - - - org.assertj - assertj-core - 3.20.2 - - - - org.apache.commons - commons-lang3 - 3.12.0 - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - - junit - junit - 4.13.2 - test - - - - org.hamcrest - hamcrest - 2.2 - test - - - org.springframework - spring-core - 5.3.9 - test - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - ${maven-enforcer-plugin.version} - - - enforce-maven - - enforce - - - - - 3.3.9 - - - - - - - - com.soebes.maven.plugins.mlv - maven-license-verifier-plugin - ${maven-license-verifier-plugin.version} - - - org.hamcrest:hamcrest:jar:2.2 - - src/main/resources/licenses.xml - true - true - true - - - - - verify - - - - - - - com.mycila - license-maven-plugin - ${license-maven-plugin.version} - - true - true -
APACHE-2-with-modifications.txt
- - Frank Jakop - - - - **/README.md - src/test/resources/** - src/main/resources/** - -
- - - - check - - - -
- - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - test-jar - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - true - - ossrh - https://oss.sonatype.org/ - false - - - -
-
- - - - release - - - - org.apache.maven.plugins - maven-release-plugin - ${maven-release-plugin.version} - - true - @{project.version} - false - release - deploy - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - gpg - - - - sign-artifacts - verify - - sign - - - - - - - - - - coverage-per-test - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - pre-test - - prepare-agent - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - listener - org.sonar.java.jacoco.JUnitListener - - - - - - - - - org.sonarsource.java - sonar-jacoco-listeners - ${sonar-jacoco-listeners.version} - test - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - -
+ + + + 4.0.0 + + de.jakop.validation + annotation-validator + 2.0.2 + jar + + Annotation Validator + + + Check classes, methods or fields for annotations with specific parameters. + + + 2020 + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Frank Jakop + + + + http://github.com/fjakop/annotation-validator + + + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + https://github.com/fjakop/annotation-validator + annotation-validator-2.0.2 + + + + UTF-8 + 1.8 + ${java.version} + ${java.version} + + 0.8.5 + 3.0 + 3.0.0-M3 + 1.6 + 3.2.0 + 3.2.0 + 0.4 + 3.0.0-M1 + 3.2.1 + 1.6.8 + 3.0.0-M5 + 5.14.0.18788 + + fjakop_annotation-validator + fjakop-github + https://sonarcloud.io + + + + + + org.assertj + assertj-core + 3.20.2 + + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + junit + junit + 4.13.2 + test + + + + org.hamcrest + hamcrest + 2.2 + test + + + org.springframework + spring-core + 5.3.9 + test + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-maven + + enforce + + + + + 3.3.9 + + + + + + + + com.soebes.maven.plugins.mlv + maven-license-verifier-plugin + ${maven-license-verifier-plugin.version} + + + org.hamcrest:hamcrest:jar:2.2 + + src/main/resources/licenses.xml + true + true + true + + + + + verify + + + + + + + com.mycila + license-maven-plugin + ${license-maven-plugin.version} + + true + true +
APACHE-2-with-modifications.txt
+ + Frank Jakop + + + + **/README.md + src/test/resources/** + src/main/resources/** + +
+ + + + check + + + +
+ + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + false + + + +
+
+ + + + release + + + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + true + @{project.version} + false + release + deploy + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + attach-javadocs + + jar + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + gpg + + + + sign-artifacts + verify + + sign + + + + + + + + + + coverage-per-test + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-test + + prepare-agent + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + listener + org.sonar.java.jacoco.JUnitListener + + + + + + + + + org.sonarsource.java + sonar-jacoco-listeners + ${sonar-jacoco-listeners.version} + test + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + +
From c850f00b9f51a7699fa2300c2a455893a5a972bc Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:25:48 +0200 Subject: [PATCH 27/30] [maven-release-plugin] rollback the release of annotation-validator-2.0.2 --- pom.xml | 677 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 339 insertions(+), 338 deletions(-) diff --git a/pom.xml b/pom.xml index 8aad420..57f8285 100644 --- a/pom.xml +++ b/pom.xml @@ -1,338 +1,339 @@ - - - - 4.0.0 - - de.jakop.validation - annotation-validator - 2.0.2 - jar - - Annotation Validator - - - Check classes, methods or fields for annotations with specific parameters. - - - 2020 - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Frank Jakop - - - - http://github.com/fjakop/annotation-validator - - - scm:git:ssh://git@github.com/fjakop/annotation-validator.git - scm:git:ssh://git@github.com/fjakop/annotation-validator.git - https://github.com/fjakop/annotation-validator - annotation-validator-2.0.2 - - - - UTF-8 - 1.8 - ${java.version} - ${java.version} - - 0.8.5 - 3.0 - 3.0.0-M3 - 1.6 - 3.2.0 - 3.2.0 - 0.4 - 3.0.0-M1 - 3.2.1 - 1.6.8 - 3.0.0-M5 - 5.14.0.18788 - - fjakop_annotation-validator - fjakop-github - https://sonarcloud.io - - - - - - org.assertj - assertj-core - 3.20.2 - - - - org.apache.commons - commons-lang3 - 3.12.0 - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - - junit - junit - 4.13.2 - test - - - - org.hamcrest - hamcrest - 2.2 - test - - - org.springframework - spring-core - 5.3.9 - test - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - ${maven-enforcer-plugin.version} - - - enforce-maven - - enforce - - - - - 3.3.9 - - - - - - - - com.soebes.maven.plugins.mlv - maven-license-verifier-plugin - ${maven-license-verifier-plugin.version} - - - org.hamcrest:hamcrest:jar:2.2 - - src/main/resources/licenses.xml - true - true - true - - - - - verify - - - - - - - com.mycila - license-maven-plugin - ${license-maven-plugin.version} - - true - true -
APACHE-2-with-modifications.txt
- - Frank Jakop - - - - **/README.md - src/test/resources/** - src/main/resources/** - -
- - - - check - - - -
- - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - test-jar - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - true - - ossrh - https://oss.sonatype.org/ - false - - - -
-
- - - - release - - - - org.apache.maven.plugins - maven-release-plugin - ${maven-release-plugin.version} - - true - @{project.version} - false - release - deploy - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - gpg - - - - sign-artifacts - verify - - sign - - - - - - - - - - coverage-per-test - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - pre-test - - prepare-agent - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - listener - org.sonar.java.jacoco.JUnitListener - - - - - - - - - org.sonarsource.java - sonar-jacoco-listeners - ${sonar-jacoco-listeners.version} - test - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - -
+ + + + 4.0.0 + + de.jakop.validation + annotation-validator + 2.0.2-SNAPSHOT + jar + + Annotation Validator + + + Check classes, methods or fields for annotations with specific parameters. + + + 2020 + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Frank Jakop + + + + http://github.com/fjakop/annotation-validator + + + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + scm:git:ssh://git@github.com/fjakop/annotation-validator.git + https://github.com/fjakop/annotation-validator + + + + + UTF-8 + 1.8 + ${java.version} + ${java.version} + + 0.8.5 + 3.0 + 3.0.0-M3 + 1.6 + 3.2.0 + 3.2.0 + 0.4 + 3.0.0-M1 + 3.2.1 + 1.6.8 + 3.0.0-M5 + 5.14.0.18788 + + fjakop_annotation-validator + fjakop-github + https://sonarcloud.io + + + + + + org.assertj + assertj-core + 3.20.2 + + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + junit + junit + 4.13.2 + test + + + + org.hamcrest + hamcrest + 2.2 + test + + + org.springframework + spring-core + 5.3.9 + test + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-maven + + enforce + + + + + 3.3.9 + + + + + + + + com.soebes.maven.plugins.mlv + maven-license-verifier-plugin + ${maven-license-verifier-plugin.version} + + + org.hamcrest:hamcrest:jar:2.2 + + src/main/resources/licenses.xml + true + true + true + + + + + verify + + + + + + + com.mycila + license-maven-plugin + ${license-maven-plugin.version} + + true + true +
APACHE-2-with-modifications.txt
+ + Frank Jakop + + + + **/README.md + src/test/resources/** + src/main/resources/** + +
+ + + + check + + + +
+ + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + false + + + +
+
+ + + + release + + + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + true + @{project.version} + false + release + deploy + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + attach-javadocs + + jar + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + gpg + + + + sign-artifacts + verify + + sign + + + + + + + + + + coverage-per-test + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-test + + prepare-agent + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + listener + org.sonar.java.jacoco.JUnitListener + + + + + + + + + org.sonarsource.java + sonar-jacoco-listeners + ${sonar-jacoco-listeners.version} + test + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + +
From c49b4415b0ed78a3c43ba75ab838f35048b410c4 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:27:49 +0200 Subject: [PATCH 28/30] docs: update repository connections --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 57f8285..a360b22 100644 --- a/pom.xml +++ b/pom.xml @@ -48,11 +48,11 @@ - http://github.com/fjakop/annotation-validator + https://github.com/fjakop/annotation-validator - scm:git:ssh://git@github.com/fjakop/annotation-validator.git - scm:git:ssh://git@github.com/fjakop/annotation-validator.git + scm:git:https://github.com/fjakop/annotation-validator.git + scm:git:https://github.com/fjakop/annotation-validator.git https://github.com/fjakop/annotation-validator From 3c4f7a87efdb4a146e49469f2b12133872925898 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:28:05 +0200 Subject: [PATCH 29/30] [maven-release-plugin] prepare release annotation-validator-2.0.2 --- pom.xml | 677 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 338 insertions(+), 339 deletions(-) diff --git a/pom.xml b/pom.xml index a360b22..49fbfe7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,339 +1,338 @@ - - - - 4.0.0 - - de.jakop.validation - annotation-validator - 2.0.2-SNAPSHOT - jar - - Annotation Validator - - - Check classes, methods or fields for annotations with specific parameters. - - - 2020 - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Frank Jakop - - - - https://github.com/fjakop/annotation-validator - - - scm:git:https://github.com/fjakop/annotation-validator.git - scm:git:https://github.com/fjakop/annotation-validator.git - https://github.com/fjakop/annotation-validator - - - - - UTF-8 - 1.8 - ${java.version} - ${java.version} - - 0.8.5 - 3.0 - 3.0.0-M3 - 1.6 - 3.2.0 - 3.2.0 - 0.4 - 3.0.0-M1 - 3.2.1 - 1.6.8 - 3.0.0-M5 - 5.14.0.18788 - - fjakop_annotation-validator - fjakop-github - https://sonarcloud.io - - - - - - org.assertj - assertj-core - 3.20.2 - - - - org.apache.commons - commons-lang3 - 3.12.0 - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - - junit - junit - 4.13.2 - test - - - - org.hamcrest - hamcrest - 2.2 - test - - - org.springframework - spring-core - 5.3.9 - test - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - ${maven-enforcer-plugin.version} - - - enforce-maven - - enforce - - - - - 3.3.9 - - - - - - - - com.soebes.maven.plugins.mlv - maven-license-verifier-plugin - ${maven-license-verifier-plugin.version} - - - org.hamcrest:hamcrest:jar:2.2 - - src/main/resources/licenses.xml - true - true - true - - - - - verify - - - - - - - com.mycila - license-maven-plugin - ${license-maven-plugin.version} - - true - true -
APACHE-2-with-modifications.txt
- - Frank Jakop - - - - **/README.md - src/test/resources/** - src/main/resources/** - -
- - - - check - - - -
- - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - test-jar - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - true - - ossrh - https://oss.sonatype.org/ - false - - - -
-
- - - - release - - - - org.apache.maven.plugins - maven-release-plugin - ${maven-release-plugin.version} - - true - @{project.version} - false - release - deploy - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - gpg - - - - sign-artifacts - verify - - sign - - - - - - - - - - coverage-per-test - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - pre-test - - prepare-agent - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - listener - org.sonar.java.jacoco.JUnitListener - - - - - - - - - org.sonarsource.java - sonar-jacoco-listeners - ${sonar-jacoco-listeners.version} - test - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - -
+ + + + 4.0.0 + + de.jakop.validation + annotation-validator + 2.0.2 + jar + + Annotation Validator + + + Check classes, methods or fields for annotations with specific parameters. + + + 2020 + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Frank Jakop + + + + https://github.com/fjakop/annotation-validator + + + scm:git:https://github.com/fjakop/annotation-validator.git + scm:git:https://github.com/fjakop/annotation-validator.git + https://github.com/fjakop/annotation-validator + annotation-validator-2.0.2 + + + + UTF-8 + 1.8 + ${java.version} + ${java.version} + + 0.8.5 + 3.0 + 3.0.0-M3 + 1.6 + 3.2.0 + 3.2.0 + 0.4 + 3.0.0-M1 + 3.2.1 + 1.6.8 + 3.0.0-M5 + 5.14.0.18788 + + fjakop_annotation-validator + fjakop-github + https://sonarcloud.io + + + + + + org.assertj + assertj-core + 3.20.2 + + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + junit + junit + 4.13.2 + test + + + + org.hamcrest + hamcrest + 2.2 + test + + + org.springframework + spring-core + 5.3.9 + test + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-maven + + enforce + + + + + 3.3.9 + + + + + + + + com.soebes.maven.plugins.mlv + maven-license-verifier-plugin + ${maven-license-verifier-plugin.version} + + + org.hamcrest:hamcrest:jar:2.2 + + src/main/resources/licenses.xml + true + true + true + + + + + verify + + + + + + + com.mycila + license-maven-plugin + ${license-maven-plugin.version} + + true + true +
APACHE-2-with-modifications.txt
+ + Frank Jakop + + + + **/README.md + src/test/resources/** + src/main/resources/** + +
+ + + + check + + + +
+ + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + false + + + +
+
+ + + + release + + + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + true + @{project.version} + false + release + deploy + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + attach-javadocs + + jar + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + gpg + + + + sign-artifacts + verify + + sign + + + + + + + + + + coverage-per-test + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-test + + prepare-agent + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + listener + org.sonar.java.jacoco.JUnitListener + + + + + + + + + org.sonarsource.java + sonar-jacoco-listeners + ${sonar-jacoco-listeners.version} + test + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + +
From 083d36b98e4fca708a635eec0ad61179e5148ce0 Mon Sep 17 00:00:00 2001 From: Frank Jakop Date: Thu, 2 Sep 2021 11:28:09 +0200 Subject: [PATCH 30/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 49fbfe7..f5869d6 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ de.jakop.validation annotation-validator - 2.0.2 + 2.0.3-SNAPSHOT jar Annotation Validator @@ -53,7 +53,7 @@ scm:git:https://github.com/fjakop/annotation-validator.git scm:git:https://github.com/fjakop/annotation-validator.git https://github.com/fjakop/annotation-validator - annotation-validator-2.0.2 +