From 27a04a45eb31bf2492d1ef38046963249ff92770 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:30:44 +0000 Subject: [PATCH 1/2] fix(deps): update dependency com.thoughtworks.paranamer:paranamer to v2.8.1 Signed-off-by: Renovate Bot --- jgiven-core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jgiven-core/build.gradle b/jgiven-core/build.gradle index 601232b532..246b529388 100644 --- a/jgiven-core/build.gradle +++ b/jgiven-core/build.gradle @@ -7,7 +7,7 @@ description = "JGiven core module" dependencies { api 'com.google.guava:guava:33.4.0-jre' api 'com.google.code.gson:gson:2.12.1' - implementation 'com.thoughtworks.paranamer:paranamer:2.8' + implementation 'com.thoughtworks.paranamer:paranamer:2.8.1' implementation libs.byteBuddy implementation 'org.fusesource.jansi:jansi:2.4.1' From 25a83c7d154c0fc62627a2e148230aebd898cb88 Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Thu, 27 Feb 2025 18:08:21 +0100 Subject: [PATCH 2/2] fix(Dep updates): Thoughtworks now uses Executable instead of accessible object Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- .../jgiven/impl/util/ParameterNameUtil.java | 23 ++++++++--------- .../impl/util/ParameterNameUtilTest.java | 25 +++++++++---------- .../jgiven/junit/JGivenMethodRule.java | 11 +++----- 3 files changed, 26 insertions(+), 33 deletions(-) diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ParameterNameUtil.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ParameterNameUtil.java index a73aaa38a7..dd99caf218 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ParameterNameUtil.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ParameterNameUtil.java @@ -1,20 +1,19 @@ package com.tngtech.jgiven.impl.util; -import static java.lang.String.format; - -import java.lang.reflect.AccessibleObject; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.thoughtworks.paranamer.BytecodeReadingParanamer; import com.thoughtworks.paranamer.Paranamer; import com.tngtech.jgiven.report.model.NamedArgument; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Executable; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static java.lang.String.format; public class ParameterNameUtil { private static final Logger log = LoggerFactory.getLogger( ParameterNameUtil.class ); @@ -24,7 +23,7 @@ public class ParameterNameUtil { /** * @throws NullPointerException iif {@code constructorOrMethod} is {@code null} */ - public static List mapArgumentsWithParameterNames( AccessibleObject constructorOrMethod, List arguments ) { + public static List mapArgumentsWithParameterNames(Executable constructorOrMethod, List arguments) { Preconditions.checkNotNull( constructorOrMethod, "constructorOrMethod must not be null." ); Preconditions.checkNotNull( arguments, "arguments must not be null" ); @@ -49,7 +48,7 @@ public static List mapArgumentsWithParameterNames( AccessibleObje return result; } - private static List getParameterNamesUsingParanamer( AccessibleObject constructorOrMethod ) { + private static List getParameterNamesUsingParanamer(Executable constructorOrMethod) { try { return Arrays.asList( PARANAMER.lookupParameterNames( constructorOrMethod ) ); diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ParameterNameUtilTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ParameterNameUtilTest.java index 08fbef16ed..9106aa958c 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ParameterNameUtilTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ParameterNameUtilTest.java @@ -1,21 +1,20 @@ package com.tngtech.jgiven.impl.util; -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; -import static org.assertj.core.api.Assertions.assertThat; +import com.tngtech.java.junit.dataprovider.DataProvider; +import com.tngtech.java.junit.dataprovider.DataProviderRunner; +import com.tngtech.java.junit.dataprovider.UseDataProvider; +import com.tngtech.jgiven.report.model.NamedArgument; +import org.junit.Test; +import org.junit.runner.RunWith; -import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; - -import com.tngtech.java.junit.dataprovider.DataProvider; -import com.tngtech.java.junit.dataprovider.DataProviderRunner; -import com.tngtech.java.junit.dataprovider.UseDataProvider; -import com.tngtech.jgiven.report.model.NamedArgument; +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; +import static org.assertj.core.api.Assertions.assertThat; @RunWith( DataProviderRunner.class ) public class ParameterNameUtilTest { @@ -34,8 +33,8 @@ public static Object[][] dataProviderMapArgumentsWithParameterNamesOf() throws E @Test @UseDataProvider( "dataProviderMapArgumentsWithParameterNamesOf" ) - public void testMapArgumentsWithParameterNamesOf( AccessibleObject contructorOrMethod, List arguments, - List expected ) { + public void testMapArgumentsWithParameterNamesOf(Executable contructorOrMethod, List arguments, + List expected) { // When: List result = ParameterNameUtil.mapArgumentsWithParameterNames( contructorOrMethod, arguments ); diff --git a/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java b/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java index c4fb40e44f..064b89c42b 100644 --- a/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java +++ b/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java @@ -18,15 +18,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.EnumSet; -import java.util.Iterator; -import java.util.List; +import java.util.*; import static com.tngtech.jgiven.report.model.ExecutionStatus.*; import static java.lang.String.format; @@ -150,7 +145,7 @@ protected void starting(Statement base, FrameworkMethod testMethod, Object targe @VisibleForTesting static List getNamedArguments(Statement base, FrameworkMethod method, Object target) { - AccessibleObject constructorOrMethod = method.getMethod(); + Executable constructorOrMethod = method.getMethod(); List arguments = Collections.emptyList();