From 7442c9fb8275047bcceb98332f9a41146c38e9c8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 14 May 2022 20:08:44 +0000 Subject: [PATCH 01/16] Update plugin com.github.node-gradle.node to v3.3.0 Signed-off-by: Renovate Bot --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1046c97c1f..81910711e9 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'io.codearte.nexus-staging' version '0.30.0' id 'com.github.ben-manes.versions' version '0.42.0' id 'org.sonarqube' version '3.3' apply false - id 'com.github.node-gradle.node' version '3.2.1' apply false + id 'com.github.node-gradle.node' version '3.3.0' apply false } apply plugin: 'project-report' From aa9749f6244dc60ee8f24ac381bf1c0906f29ae3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 02:07:17 +0000 Subject: [PATCH 02/16] Update plugin com.gradle.enterprise to v3.10.1 (#887) Signed-off-by: Renovate Bot Co-authored-by: Renovate Bot --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 3a19433a9e..d8c189db69 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gradle.enterprise' version '3.10' + id 'com.gradle.enterprise' version '3.10.1' } gradleEnterprise { From 82d37d8a353c6b133257a7e88c3a1626347f8eeb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 04:25:26 +0000 Subject: [PATCH 03/16] Update plugin org.springframework.boot to v2.7.0 (#888) Signed-off-by: Renovate Bot Co-authored-by: Renovate Bot --- example-projects/spring-boot/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/spring-boot/build.gradle b/example-projects/spring-boot/build.gradle index 16eed8ba16..ff185185a0 100644 --- a/example-projects/spring-boot/build.gradle +++ b/example-projects/spring-boot/build.gradle @@ -9,7 +9,7 @@ buildscript { } plugins { - id 'org.springframework.boot' version '2.6.7' + id 'org.springframework.boot' version '2.7.0' } apply plugin: 'java' From 2d7e311b99e57a5b62fd7156439f6edcc71ece03 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 20 May 2022 04:26:11 +0000 Subject: [PATCH 04/16] Update dependency org.testng:testng to v7.6.0 Signed-off-by: Renovate Bot --- example-projects/testng/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/testng/build.gradle b/example-projects/testng/build.gradle index 07b513ed55..6ffced050d 100644 --- a/example-projects/testng/build.gradle +++ b/example-projects/testng/build.gradle @@ -27,7 +27,7 @@ repositories { dependencies { testImplementation "com.tngtech.jgiven:jgiven-testng:${version}" - testImplementation 'org.testng:testng:7.5' + testImplementation 'org.testng:testng:7.6.0' } test.useTestNG() { From 00ed10166037febf69dde57b05aa60c0adfb580b Mon Sep 17 00:00:00 2001 From: l-1sqared <30831153+l-1squared@users.noreply.github.com> Date: Tue, 24 May 2022 07:10:55 +0200 Subject: [PATCH 05/16] Run testNG with Java 11 Signed-off-by: l-1sqared <30831153+l-1squared@users.noreply.github.com> --- .github/workflows/jgiven_examples_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jgiven_examples_build.yml b/.github/workflows/jgiven_examples_build.yml index d0c85c5345..10dd578f5c 100644 --- a/.github/workflows/jgiven_examples_build.yml +++ b/.github/workflows/jgiven_examples_build.yml @@ -31,8 +31,6 @@ jobs: run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/spock/build.gradle 1.1-t - name: Test Spring-Boot Example Project run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/spring-boot/build.gradle 1.1-t - - name: Test TestNG Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/testng/build.gradle 1.1-t - name: Test Maven Example Project run: source scripts/source_files/helper_functions.sh && runMavenTestOnGivenProject example-projects/maven/pom.xml 1.1-t - name: Upload test results html files @@ -59,6 +57,8 @@ jobs: run: source scripts/local_release_with_version.sh - name: Test Java 11 Project run: source scripts/source_files/helper_functions.sh && runMavenTestOnGivenProject example-projects/java11/pom.xml 1.1-t + - name: Test TestNG Example Project + run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/testng/build.gradle 1.1-t - name: Upload test results html files continue-on-error: true if: ${{failure()}} From a040fff9299e2d5014f9522ff38e27547bb4479e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 25 May 2022 22:02:25 +0000 Subject: [PATCH 06/16] Update dependency io.github.bonigarcia:webdrivermanager to v5.2.0 Signed-off-by: Renovate Bot --- example-projects/selenium/build.gradle | 2 +- jgiven-tests/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example-projects/selenium/build.gradle b/example-projects/selenium/build.gradle index 3437456623..4db8687bb9 100644 --- a/example-projects/selenium/build.gradle +++ b/example-projects/selenium/build.gradle @@ -32,7 +32,7 @@ dependencies { testImplementation "com.tngtech.jgiven:jgiven-junit:${version}" testImplementation 'junit:junit:4.13.2' testImplementation 'org.seleniumhq.selenium:selenium-java:4.1.4' - testImplementation 'io.github.bonigarcia:webdrivermanager:5.1.1' + testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.assertj:assertj-core:3.22.0' } diff --git a/jgiven-tests/build.gradle b/jgiven-tests/build.gradle index 933d8ae2b7..73dc73aa40 100644 --- a/jgiven-tests/build.gradle +++ b/jgiven-tests/build.gradle @@ -15,7 +15,7 @@ dependencies { implementation "org.assertj:assertj-core:$assertjVersion" testImplementation 'org.seleniumhq.selenium:selenium-java:4.1.4' - testImplementation 'io.github.bonigarcia:webdrivermanager:5.1.1' + testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.apache.commons:commons-io:1.3.2' } test.finalizedBy(jgivenHtml5Report) From c5da220978abbc89e50d7cea3b0e31d91a030185 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 May 2022 03:09:46 +0000 Subject: [PATCH 07/16] Update dependency org.seleniumhq.selenium:selenium-java to v4.2.0 (#890) Signed-off-by: Renovate Bot Co-authored-by: Renovate Bot --- example-projects/selenium/build.gradle | 2 +- jgiven-tests/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example-projects/selenium/build.gradle b/example-projects/selenium/build.gradle index 4db8687bb9..25a0176e72 100644 --- a/example-projects/selenium/build.gradle +++ b/example-projects/selenium/build.gradle @@ -31,7 +31,7 @@ repositories { dependencies { testImplementation "com.tngtech.jgiven:jgiven-junit:${version}" testImplementation 'junit:junit:4.13.2' - testImplementation 'org.seleniumhq.selenium:selenium-java:4.1.4' + testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.assertj:assertj-core:3.22.0' diff --git a/jgiven-tests/build.gradle b/jgiven-tests/build.gradle index 73dc73aa40..5fef4d745b 100644 --- a/jgiven-tests/build.gradle +++ b/jgiven-tests/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation 'com.beust:jcommander:1.82' implementation "org.assertj:assertj-core:$assertjVersion" - testImplementation 'org.seleniumhq.selenium:selenium-java:4.1.4' + testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.apache.commons:commons-io:1.3.2' } From 555091d474211dd653ce9de47d25f8bd3b2b2691 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 May 2022 05:38:12 +0000 Subject: [PATCH 08/16] Update mockito monorepo to v4.6.0 (#891) Signed-off-by: Renovate Bot Co-authored-by: Renovate Bot --- jgiven-junit/build.gradle | 2 +- jgiven-testng/build.gradle | 2 +- jgiven-timing/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jgiven-junit/build.gradle b/jgiven-junit/build.gradle index 235ce3d2db..2893581311 100644 --- a/jgiven-junit/build.gradle +++ b/jgiven-junit/build.gradle @@ -12,7 +12,7 @@ dependencies { testImplementation "junit:junit:$junitVersion" testImplementation "pl.pragmatists:JUnitParams:$junitParamsVersion" testImplementation "com.googlecode.junit-toolbox:junit-toolbox:2.4" - testImplementation "org.mockito:mockito-core:4.5.1" + testImplementation "org.mockito:mockito-core:4.6.0" } test.finalizedBy(jgivenHtml5Report) diff --git a/jgiven-testng/build.gradle b/jgiven-testng/build.gradle index a95b3f13fd..7ede2f22f0 100644 --- a/jgiven-testng/build.gradle +++ b/jgiven-testng/build.gradle @@ -10,7 +10,7 @@ dependencies { compileOnly "org.testng:testng:$testngVersion" testImplementation "org.testng:testng:$testngVersion" - testImplementation "org.mockito:mockito-core:4.5.1" + testImplementation "org.mockito:mockito-core:4.6.0" } test.useTestNG() { diff --git a/jgiven-timing/build.gradle b/jgiven-timing/build.gradle index 9f35e289c2..fb8866c0f6 100644 --- a/jgiven-timing/build.gradle +++ b/jgiven-timing/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation "net.bytebuddy:byte-buddy-gradle-plugin:$byteBuddyVersion" implementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion" testImplementation("com.google.guava:guava-testlib:$guavaVersion") - testImplementation 'org.mockito:mockito-inline:4.5.1' + testImplementation 'org.mockito:mockito-inline:4.6.0' } def generatedSourceDir = "generatedSrc/java" From e9a547d7af5996c6f3d306a8787880f5b0dbd4e6 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 30 May 2022 23:05:54 +0000 Subject: [PATCH 09/16] Update dependency org.assertj:assertj-core to v3.23.0 Signed-off-by: Renovate Bot --- example-projects/selenium/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/selenium/build.gradle b/example-projects/selenium/build.gradle index 25a0176e72..6d65b0dbe7 100644 --- a/example-projects/selenium/build.gradle +++ b/example-projects/selenium/build.gradle @@ -33,7 +33,7 @@ dependencies { testImplementation 'junit:junit:4.13.2' testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' - testImplementation 'org.assertj:assertj-core:3.22.0' + testImplementation 'org.assertj:assertj-core:3.23.0' } From d8d48465aeaa76a693d0022c27c13bf534963059 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 31 May 2022 01:11:50 +0000 Subject: [PATCH 10/16] Update dependency org.assertj:assertj-core to v3.23.0 Signed-off-by: Renovate Bot --- example-projects/spring-boot/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/spring-boot/build.gradle b/example-projects/spring-boot/build.gradle index ff185185a0..8f873c26ca 100644 --- a/example-projects/spring-boot/build.gradle +++ b/example-projects/spring-boot/build.gradle @@ -29,7 +29,7 @@ repositories { } ext { - assertjVersion = '3.22.0' + assertjVersion = '3.23.0' junitDataproviderVersion = '1.13.1' jgivenVersion = version hsqldbVersion = '2.6.1' From ee1e055ded7d754e933b9a97fb1c2a9977ccf851 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 1 Jun 2022 00:07:35 +0000 Subject: [PATCH 11/16] Update dependency org.assertj:assertj-core to v3.23.1 Signed-off-by: Renovate Bot --- example-projects/spring-boot/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/spring-boot/build.gradle b/example-projects/spring-boot/build.gradle index 8f873c26ca..deb485b4bc 100644 --- a/example-projects/spring-boot/build.gradle +++ b/example-projects/spring-boot/build.gradle @@ -29,7 +29,7 @@ repositories { } ext { - assertjVersion = '3.23.0' + assertjVersion = '3.23.1' junitDataproviderVersion = '1.13.1' jgivenVersion = version hsqldbVersion = '2.6.1' From 4fd960c24d66ff9d33040eb10710995c831841f3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 1 Jun 2022 02:47:53 +0000 Subject: [PATCH 12/16] Update dependency org.assertj:assertj-core to v3.23.1 Signed-off-by: Renovate Bot --- example-projects/selenium/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-projects/selenium/build.gradle b/example-projects/selenium/build.gradle index 6d65b0dbe7..8bf31de152 100644 --- a/example-projects/selenium/build.gradle +++ b/example-projects/selenium/build.gradle @@ -33,7 +33,7 @@ dependencies { testImplementation 'junit:junit:4.13.2' testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' - testImplementation 'org.assertj:assertj-core:3.23.0' + testImplementation 'org.assertj:assertj-core:3.23.1' } From 533491e1a6cfe454c3bdbd6efee4d9eb6b42a673 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 1 Jun 2022 22:40:26 +0000 Subject: [PATCH 13/16] Update dependency androidx.appcompat:appcompat to v1.4.2 Signed-off-by: Renovate Bot --- example-projects/android/build.gradle | 2 +- jgiven-android-test/build.gradle | 2 +- jgiven-android/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example-projects/android/build.gradle b/example-projects/android/build.gradle index bbc44b948b..cdbaac3b65 100644 --- a/example-projects/android/build.gradle +++ b/example-projects/android/build.gradle @@ -46,7 +46,7 @@ configurations { } dependencies { - implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'androidx.appcompat:appcompat:1.4.2' androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0', { exclude group: 'com.android.support', module: 'support-annotations' diff --git a/jgiven-android-test/build.gradle b/jgiven-android-test/build.gradle index 3e77074757..16a0b42998 100644 --- a/jgiven-android-test/build.gradle +++ b/jgiven-android-test/build.gradle @@ -45,7 +45,7 @@ configurations { } dependencies { - implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'androidx.appcompat:appcompat:1.4.2' androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0', { exclude group: 'com.android.support', module: 'support-annotations' diff --git a/jgiven-android/build.gradle b/jgiven-android/build.gradle index 04d06d9fc7..f717b5ee2b 100644 --- a/jgiven-android/build.gradle +++ b/jgiven-android/build.gradle @@ -63,7 +63,7 @@ dependencies { api "com.google.guava:guava:$guavaAndroidVersion" api("net.bytebuddy:byte-buddy-android:$byteBuddyVersion") api "junit:junit:$junitVersion" - implementation "androidx.appcompat:appcompat:1.4.1" + implementation "androidx.appcompat:appcompat:1.4.2" implementation('androidx.test:core:1.4.0') implementation('androidx.test:rules:1.4.0') { exclude group: "junit" From 9490f59c072d28f8e9ee093efb1404476caa17e7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Jun 2022 04:22:56 +0000 Subject: [PATCH 14/16] Update dependency org.seleniumhq.selenium:selenium-java to v4.2.1 (#898) Signed-off-by: Renovate Bot Co-authored-by: Renovate Bot --- example-projects/selenium/build.gradle | 2 +- jgiven-tests/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example-projects/selenium/build.gradle b/example-projects/selenium/build.gradle index 8bf31de152..fd070f2a35 100644 --- a/example-projects/selenium/build.gradle +++ b/example-projects/selenium/build.gradle @@ -31,7 +31,7 @@ repositories { dependencies { testImplementation "com.tngtech.jgiven:jgiven-junit:${version}" testImplementation 'junit:junit:4.13.2' - testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' + testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.1' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.assertj:assertj-core:3.23.1' diff --git a/jgiven-tests/build.gradle b/jgiven-tests/build.gradle index 5fef4d745b..233cfd5c30 100644 --- a/jgiven-tests/build.gradle +++ b/jgiven-tests/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation 'com.beust:jcommander:1.82' implementation "org.assertj:assertj-core:$assertjVersion" - testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.0' + testImplementation 'org.seleniumhq.selenium:selenium-java:4.2.1' testImplementation 'io.github.bonigarcia:webdrivermanager:5.2.0' testImplementation 'org.apache.commons:commons-io:1.3.2' } From 3a2e0380630294b00371855f8c08876c7e28b3fb Mon Sep 17 00:00:00 2001 From: l-1sqared <30831153+l-1squared@users.noreply.github.com> Date: Tue, 31 May 2022 08:08:41 +0200 Subject: [PATCH 15/16] Issue-868: fix too many parents for tags Signed-off-by: l-1sqared <30831153+l-1squared@users.noreply.github.com> --- .../jgiven/impl/ScenarioModelBuilder.java | 2 +- .../tngtech/jgiven/impl/tag/ResolvedTags.java | 16 +++--- .../tngtech/jgiven/impl/tag/TagCreator.java | 50 +++++++++---------- .../jgiven/report/model/ReportModel.java | 6 +-- .../jgiven/impl/tag/ResolvedTagsTest.java | 6 +-- .../jgiven/impl/tag/TagClassCollection.java | 4 ++ .../jgiven/impl/tag/TagCreatorTest.java | 45 +++++++++++++---- 7 files changed, 78 insertions(+), 51 deletions(-) diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioModelBuilder.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioModelBuilder.java index 25fe58eecd..f945903ea1 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioModelBuilder.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioModelBuilder.java @@ -504,7 +504,7 @@ private void addTags(ResolvedTags tags) { if (reportModel != null) { this.reportModel.addTags(tags.getDeclaredTags()); //The report model needs to declare the parent tags in a tag map, or the tags cannot be displayed. - this.reportModel.addTags(tags.getParents()); + this.reportModel.addTags(tags.getAncestors()); } if (scenarioModel != null) { diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/ResolvedTags.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/ResolvedTags.java index a52dcf6755..bba8ad8e53 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/ResolvedTags.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/ResolvedTags.java @@ -3,6 +3,7 @@ import com.tngtech.jgiven.report.model.Tag; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -15,8 +16,11 @@ public List getDeclaredTags() { return resolvedTags.stream().map(resolvedTag -> resolvedTag.tag).collect(Collectors.toList()); } - public List getParents() { - return resolvedTags.stream().flatMap(resolvedTag -> resolvedTag.parents.stream()).collect(Collectors.toList()); + @SuppressWarnings("CheckStyle") + public Set getAncestors() { + return resolvedTags.stream() + .flatMap(resolvedTag -> resolvedTag.ancestors.stream()) + .collect(Collectors.toSet()); } public boolean isEmpty() { @@ -24,16 +28,16 @@ public boolean isEmpty() { } /** - * A single tag declared for a scenario and the parents necessary to display it. + * A single tag declared for a scenario and the ancestors necessary to display it. */ public static class ResolvedTag { public final Tag tag; - public final List parents; + public final List ancestors; - ResolvedTag(Tag tag, List parents) { + ResolvedTag(Tag tag, List ancestors) { this.tag = tag; - this.parents = parents; + this.ancestors = ancestors; } } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/TagCreator.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/TagCreator.java index a1e8e66bd8..af60cec3a4 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/TagCreator.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/tag/TagCreator.java @@ -10,6 +10,7 @@ import com.tngtech.jgiven.report.model.Tag; import java.lang.annotation.Annotation; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -48,14 +49,14 @@ public ResolvedTags toTags(Class annotationClass, String.. return new ResolvedTags(); } - List parents = getTags(annotationClass); + List ancestors = getAllAncestorTags(annotationClass); if (values.length > 0) { List explodedTags = getExplodedTags(Iterables.getOnlyElement(tags), values, null, tagConfig); return explodedTags.stream() - .map(tag -> new ResolvedTags.ResolvedTag(tag, parents)) + .map(tag -> new ResolvedTags.ResolvedTag(tag, ancestors)) .collect(new TagCollector()); } else { - return ResolvedTags.from(new ResolvedTags.ResolvedTag(Iterables.getOnlyElement(tags), parents)); + return ResolvedTags.from(new ResolvedTags.ResolvedTag(Iterables.getOnlyElement(tags), ancestors)); } } @@ -71,7 +72,7 @@ public ResolvedTags toTags(Annotation annotation) { } List tags = processConfiguredAnnotation(tagConfig, annotation); - List parents = getTags(annotationType); + List parents = getAllAncestorTags(annotationType); return tags.stream() .map(tag -> new ResolvedTags.ResolvedTag(tag, parents)) .collect(new TagCollector()); @@ -177,37 +178,34 @@ private TagConfiguration fromIsTag(IsTag isTag, Class anno .cssClass(isTag.cssClass()) .color(isTag.color()) .style(isTag.style()) - .tags(getTagNames(annotationType)) + .tags(getNamesOfParentTags(annotationType)) .href(isTag.href()) .hrefGenerator(isTag.hrefGenerator()) .showInNavigation(isTag.showInNavigation()) .build(); } - private List getTagNames(Class annotationType) { - List tags = getTags(annotationType); - List tagNames = Lists.newArrayList(); - for (Tag tag : tags) { - tagNames.add(tag.toIdString()); - } - return tagNames; + private List getNamesOfParentTags(Class annotationType) { + return getTagAnnotationsOn(annotationType) + .flatMap(resolvedTags -> resolvedTags.getDeclaredTags().stream()) + .map(Tag::toIdString) + .collect(Collectors.toList()); } - private List getTags(Class annotationType) { - List allTags = Lists.newArrayList(); - - for (Annotation annotation : annotationType.getAnnotations()) { - if (annotation.annotationType().isAnnotationPresent(IsTag.class)) { - allTags.addAll(toTags(annotation).resolvedTags.stream() - .flatMap(tag -> { - Stream tagStream = Stream.of(tag.tag); - return Stream.concat(tagStream, tag.parents.stream()); - }) - .collect(Collectors.toList())); - } - } + private List getAllAncestorTags(Class annotationType) { + return getTagAnnotationsOn(annotationType) + .flatMap(resolvedTags -> resolvedTags.resolvedTags.stream()) + .flatMap(tag -> { + Stream tagStream = Stream.of(tag.tag); + return Stream.concat(tagStream, tag.ancestors.stream()); + }) + .collect(Collectors.toList()); + } - return allTags; + private Stream getTagAnnotationsOn(Class annotationType) { + return Arrays.stream(annotationType.getAnnotations()) + .filter(a -> a.annotationType().isAnnotationPresent(IsTag.class)) + .map(this::toTags); } private List toStringList(Object[] value) { diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java index e5fd92df20..89d5b29e35 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModel.java @@ -137,10 +137,8 @@ public synchronized void addTag(Tag tag) { this.tagMap.put(tag.toIdString(), tag); } - public synchronized void addTags(List tags) { - for (Tag tag : tags) { - addTag(tag); - } + public synchronized void addTags(Iterable tags) { + tags.forEach(this::addTag); } public synchronized Tag getTagWithId(String tagId) { diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/ResolvedTagsTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/ResolvedTagsTest.java index 4f744a6a2f..96a6d33552 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/ResolvedTagsTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/ResolvedTagsTest.java @@ -12,13 +12,13 @@ public class ResolvedTagsTest { public void testResolvedTagsFiltersForDirectTags() { ResolvedTags underTest = TestTagGenerator.getEnumeratedResolvedTags(5); assertThat(underTest.getDeclaredTags()).extracting(Tag::getFullType) - .containsExactly("tag1", "tag2", "tag3", "tag4", "tag5"); + .containsExactlyInAnyOrder("tag1", "tag2", "tag3", "tag4", "tag5"); } @Test public void testResolvedTagsFiltersForParents() { ResolvedTags underTest = TestTagGenerator.getEnumeratedResolvedTags(5); - assertThat(underTest.getParents()).extracting(Tag::getFullType) - .containsExactly("parent1", "parent2", "parent3", "parent4", "parent5"); + assertThat(underTest.getAncestors()).extracting(Tag::getFullType) + .containsExactlyInAnyOrder("parent1", "parent2", "parent3", "parent4", "parent5"); } } diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagClassCollection.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagClassCollection.java index f509528b56..3ea41af8aa 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagClassCollection.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagClassCollection.java @@ -131,7 +131,11 @@ class AnnotationWithDescriptionAndIgnoreValue { @interface TagWithGrandparentTags { } + + @SuppressWarnings("checkstyle:OneTopLevelClass") @TagWithParentTags class AnnotationWithParentTag { } + + diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagCreatorTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagCreatorTest.java index 0a9f85edd2..5704a490fd 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagCreatorTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/tag/TagCreatorTest.java @@ -12,6 +12,7 @@ import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; +import java.util.stream.Stream; import org.junit.Before; import org.junit.Test; @@ -29,7 +30,7 @@ public void addLogInterceptor() { @Test public void testAnnotationParsing() { Tag tag = getOnlyTagFor(AnnotationTestClass.class.getAnnotations()[0]); - assertThat(tag.getName()).isEqualTo("AnnotationWithoutValue"); + assertThat(tag.getName()).isEqualTo(AnnotationWithoutValue.class.getSimpleName()); assertThat(tag.getValues()).isEmpty(); assertThat(interceptor.containsLoggingEvent(record -> record.getLevel() == Level.SEVERE)) .as("Attempt to convert an annotation without value method results in an error log") @@ -39,7 +40,7 @@ public void testAnnotationParsing() { @Test public void testAnnotationWithValueParsing() { Tag tag = getOnlyTagFor(AnnotationWithSingleValueTestClass.class.getAnnotations()[0]); - assertThat(tag.getName()).isEqualTo("AnnotationWithSingleValue"); + assertThat(tag.getName()).isEqualTo(AnnotationWithSingleValue.class.getSimpleName()); assertThat(tag.getValues()).containsExactly("testvalue"); } @@ -54,7 +55,7 @@ public void testAnnotationWithName() { @Test public void testAnnotationWithIgnoredValueParsing() { Tag tag = getOnlyTagFor(AnnotationWithIgnoredValueTestClass.class.getAnnotations()[0]); - assertThat(tag.getName()).isEqualTo("AnnotationWithIgnoredValue"); + assertThat(tag.getName()).isEqualTo(AnnotationWithIgnoredValue.class.getSimpleName()); assertThat(tag.getValues()).isEmpty(); assertThat(tag.toIdString()).isEqualTo(AnnotationWithIgnoredValue.class.getName()); } @@ -62,7 +63,7 @@ public void testAnnotationWithIgnoredValueParsing() { @Test public void testAnnotationWithoutExplodedArrayParsing() { Tag tag = getOnlyTagFor(AnnotationWithoutExplodedArrayValueTestClass.class.getAnnotations()[0]); - assertThat(tag.getName()).isEqualTo("AnnotationWithoutExplodedArray"); + assertThat(tag.getName()).isEqualTo(AnnotationWithoutExplodedArray.class.getSimpleName()); assertThat(tag.getValues()).containsExactly("foo", "bar"); } @@ -85,7 +86,7 @@ public void testAnnotationWithParentTag() { Tag tag = getOnlyTagFor(AnnotationWithParentTag.class.getAnnotations()[0]); assertThat(tag.getTags()).containsAll(Arrays.asList( ParentTag.class.getName(), - ParentTagWithValue.class.getPackage().getName() + ".ParentTagWithValue-SomeValue") + ParentTagWithValue.class.getName() + "-SomeValue") ); } @@ -102,13 +103,35 @@ public void testAnnotationWithArrayParsing() { @Test public void testAllParentsOfTagAreResolved() { + String[] expectedNames = Stream.of(TagWithParentTags.class, ParentTag.class, ParentTagWithValue.class) + .map(Class::getSimpleName).toArray(String[]::new); + ResolvedTags resolvedTags = underTest.toTags(TagWithGrandparentTags.class); - assertThat(resolvedTags.getDeclaredTags()) - .extracting(Tag::getName) - .containsExactly("TagWithGrandparentTags"); - assertThat(resolvedTags.getParents()) - .extracting(Tag::getName) - .containsExactlyInAnyOrder("TagWithParentTags", "ParentTag", "ParentTagWithValue"); + + assertThat(resolvedTags.getAncestors()).extracting(Tag::getName).containsExactlyInAnyOrder(expectedNames); + assertThat(resolvedTags.getDeclaredTags()).extracting(Tag::getName) + .containsExactly(TagWithGrandparentTags.class.getSimpleName()); + } + + @Test + public void testTagConfigurationOnlyRefersToTheTagsSingleParent() { + ResolvedTags resolvedTags = underTest.toTags(TagWithGrandparentTags.class); + assertThat(resolveParentNames(resolvedTags)).containsExactly(TagWithParentTags.class.getName()); + } + + @Test + public void testTagConfigurationRefersToBothParentTags() { + ResolvedTags resolvedTags = underTest.toTags(TagWithParentTags.class); + assertThat(resolveParentNames(resolvedTags)).containsExactlyInAnyOrder( + ParentTag.class.getName(), + ParentTagWithValue.class.getName() + "-SomeValue" + ); + } + + private Stream resolveParentNames(ResolvedTags resolvedTags) { + return resolvedTags.getDeclaredTags().stream() + .map(Tag::getTags) + .flatMap(List::stream); } private Tag getOnlyTagFor(Annotation annotation) { From 527f53436432420b80dca9d859cb9367cf1471bc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 3 Jun 2022 00:41:08 +0000 Subject: [PATCH 16/16] Update mockito monorepo to v4.6.1 Signed-off-by: Renovate Bot --- jgiven-junit/build.gradle | 2 +- jgiven-testng/build.gradle | 2 +- jgiven-timing/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jgiven-junit/build.gradle b/jgiven-junit/build.gradle index 2893581311..7200ebc1ca 100644 --- a/jgiven-junit/build.gradle +++ b/jgiven-junit/build.gradle @@ -12,7 +12,7 @@ dependencies { testImplementation "junit:junit:$junitVersion" testImplementation "pl.pragmatists:JUnitParams:$junitParamsVersion" testImplementation "com.googlecode.junit-toolbox:junit-toolbox:2.4" - testImplementation "org.mockito:mockito-core:4.6.0" + testImplementation "org.mockito:mockito-core:4.6.1" } test.finalizedBy(jgivenHtml5Report) diff --git a/jgiven-testng/build.gradle b/jgiven-testng/build.gradle index 7ede2f22f0..a2403228c1 100644 --- a/jgiven-testng/build.gradle +++ b/jgiven-testng/build.gradle @@ -10,7 +10,7 @@ dependencies { compileOnly "org.testng:testng:$testngVersion" testImplementation "org.testng:testng:$testngVersion" - testImplementation "org.mockito:mockito-core:4.6.0" + testImplementation "org.mockito:mockito-core:4.6.1" } test.useTestNG() { diff --git a/jgiven-timing/build.gradle b/jgiven-timing/build.gradle index fb8866c0f6..ae3f7082fd 100644 --- a/jgiven-timing/build.gradle +++ b/jgiven-timing/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation "net.bytebuddy:byte-buddy-gradle-plugin:$byteBuddyVersion" implementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion" testImplementation("com.google.guava:guava-testlib:$guavaVersion") - testImplementation 'org.mockito:mockito-inline:4.6.0' + testImplementation 'org.mockito:mockito-inline:4.6.1' } def generatedSourceDir = "generatedSrc/java"