diff --git a/src/main/java/com/nordstrom/automation/junit/CreateTest.java b/src/main/java/com/nordstrom/automation/junit/CreateTest.java index c9c8e56..a964eec 100644 --- a/src/main/java/com/nordstrom/automation/junit/CreateTest.java +++ b/src/main/java/com/nordstrom/automation/junit/CreateTest.java @@ -60,7 +60,7 @@ public DepthGauge apply(Integer input) { public static Object intercept(@This final Object runner, @Argument(0) final FrameworkMethod method, @SuperCall final Callable proxy) throws Exception { - Integer hashCode = Objects.hash(runner, method); + Integer hashCode = Objects.hash(runner, method.toString()); DepthGauge depthGauge = LifecycleHooks.computeIfAbsent(METHOD_DEPTH.get(), hashCode, NEW_INSTANCE); depthGauge.increaseDepth(); @@ -99,7 +99,7 @@ public static Object intercept(@This final Object runner, @Argument(0) final Fra * @return target test class instance */ static Object getTargetFor(Object runner, FrameworkMethod method) { - return HASHCODE_TO_TARGET.remove(Objects.hash(runner, method)); + return HASHCODE_TO_TARGET.remove(Objects.hash(runner, method.toString())); } /** @@ -130,7 +130,7 @@ static Object getRunnerFor(Object target) { * @param target test class instance */ static void releaseMappingsFor(Object runner, FrameworkMethod method, Object target) { - HASHCODE_TO_TARGET.remove(Objects.hash(runner, method)); + HASHCODE_TO_TARGET.remove(Objects.hash(runner, method.toString())); if (target != null) { TARGET_TO_METHOD.remove(toMapKey(target)); TARGET_TO_RUNNER.remove(toMapKey(target)); diff --git a/src/main/java/com/nordstrom/automation/junit/EachTestNotifierInit.java b/src/main/java/com/nordstrom/automation/junit/EachTestNotifierInit.java index 9bb7058..6e0130a 100644 --- a/src/main/java/com/nordstrom/automation/junit/EachTestNotifierInit.java +++ b/src/main/java/com/nordstrom/automation/junit/EachTestNotifierInit.java @@ -84,7 +84,7 @@ public static void interceptor(@Argument(0) final RunNotifier notifier, // otherwise (target not yet created) } else { // store [runner + method] => description mapping for 'setTestTarget' method - HASHCODE_TO_DESCRIPTION.put(Objects.hash(runner, method), description.hashCode()); + HASHCODE_TO_DESCRIPTION.put(Objects.hash(runner, method.toString()), description.hashCode()); } } else { throw new IllegalStateException("unable to determine method"); @@ -181,7 +181,7 @@ static void createMappingsFor(Integer descriptionHash, Object target) { static void releaseMappingsFor(EachTestNotifier notifier) { Description description = getDescriptionOf(notifier); AtomicTest atomicTest = releaseAtomicTestOf(description); - HASHCODE_TO_DESCRIPTION.remove(Objects.hash(atomicTest.getRunner(), atomicTest.getIdentity())); + HASHCODE_TO_DESCRIPTION.remove(Objects.hash(atomicTest.getRunner(), atomicTest.getIdentity().toString())); Object target = DESCRIPTION_TO_TARGET.remove(description.hashCode()); if (target != null) { TARGET_TO_DESCRIPTION.remove(toMapKey(target)); @@ -242,6 +242,6 @@ private static Description getDescriptionOf(EachTestNotifier notifier) { * @return {@link Description} hash code */ private static Integer getDescriptionHashFor(Object runner, FrameworkMethod method) { - return HASHCODE_TO_DESCRIPTION.get(Objects.hash(runner, method)); + return HASHCODE_TO_DESCRIPTION.get(Objects.hash(runner, method.toString())); } } diff --git a/src/main/java/com/nordstrom/automation/junit/GetAnnotations.java b/src/main/java/com/nordstrom/automation/junit/GetAnnotations.java index aeba5dc..1062394 100644 --- a/src/main/java/com/nordstrom/automation/junit/GetAnnotations.java +++ b/src/main/java/com/nordstrom/automation/junit/GetAnnotations.java @@ -13,7 +13,7 @@ */ public class GetAnnotations { - private static final Map ANNOTATIONS = new ConcurrentHashMap<>(); + private static final Map ANNOTATIONS = new ConcurrentHashMap<>(); /** * Interceptor for the {@link org.junit.runners.model.FrameworkMethod#getAnnotations} method. @@ -36,10 +36,10 @@ public static Annotation[] intercept(@This final FrameworkMethod method) throws * @return array of annotations for the specified method */ static Annotation[] getAnnotationsFor(FrameworkMethod method) { - Annotation[] annotations = ANNOTATIONS.get(method.hashCode()); + Annotation[] annotations = ANNOTATIONS.get(method.toString()); if (annotations == null) { annotations = method.getMethod().getAnnotations(); - ANNOTATIONS.put(method.hashCode(), annotations); + ANNOTATIONS.put(method.toString(), annotations); } return annotations; } @@ -50,7 +50,7 @@ static Annotation[] getAnnotationsFor(FrameworkMethod method) { * @param method target {@link FrameworkMethod} object */ static void releaseAnnotationsFor(FrameworkMethod method) { - ANNOTATIONS.remove(method.hashCode()); + ANNOTATIONS.remove(method.toString()); } } diff --git a/src/test/java/com/nordstrom/automation/junit/ReferenceChecker.java b/src/test/java/com/nordstrom/automation/junit/ReferenceChecker.java index e0af763..619fefb 100644 --- a/src/test/java/com/nordstrom/automation/junit/ReferenceChecker.java +++ b/src/test/java/com/nordstrom/automation/junit/ReferenceChecker.java @@ -220,7 +220,7 @@ public void testFinished(Description description) throws IllegalArgumentExceptio Object runner = atomicTest.getRunner(); FrameworkMethod method = atomicTest.getIdentity(); String name = method.getName() + "(" + LifecycleHooks.toMapKey(runner) + ")"; - hashCodeMap.put(Objects.hash(runner, method), name); + hashCodeMap.put(Objects.hash(runner, method.toString()), name); Object target = LifecycleHooks.getTargetOf(description); if (target != null) {