From 2e17c2b8c8c035f880aa0bf19b5488324fbe3115 Mon Sep 17 00:00:00 2001 From: Stefano Cordio Date: Thu, 2 Jan 2025 15:11:23 +0100 Subject: [PATCH] Apply review --- .../commons/support/conversion/ConversionSupport.java | 4 +++- .../module/org.junit.platform.commons/module-info.java | 1 + .../converter/DefaultArgumentConverterTests.java | 10 +++++----- .../junit-platform-commons.expected.txt | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java index ace09392e841..76c07da943cb 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java @@ -10,6 +10,7 @@ package org.junit.platform.commons.support.conversion; +import static org.apiguardian.api.API.Status.DEPRECATED; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import java.util.ServiceLoader; @@ -52,6 +53,7 @@ private ConversionSupport() { */ @SuppressWarnings("unchecked") @Deprecated + @API(status = DEPRECATED, since = "5.12") public static T convert(String source, Class targetType, ClassLoader classLoader) { return (T) DefaultConversionService.INSTANCE.convert(source, targetType, getClassLoader(classLoader)); } @@ -84,7 +86,7 @@ public static T convert(Object source, Class targetType, ClassLoader clas .filter(candidate -> candidate.canConvert(source, targetType, classLoader)) // .findFirst() // .map(candidate -> candidate.convert(source, targetType, classLoaderToUse)) // - .orElseThrow(() -> new ConversionException("No built-in converter for source type " + .orElseThrow(() -> new ConversionException("No registered or built-in converter for source type " + source.getClass().getTypeName() + " and target type " + targetType.getTypeName())); } diff --git a/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java b/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java index fb3fdba07a68..fafcfd8cc86b 100644 --- a/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java +++ b/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java @@ -53,5 +53,6 @@ org.junit.platform.suite.engine, org.junit.platform.testkit, org.junit.vintage.engine; + uses org.junit.platform.commons.support.conversion.ConversionService; uses org.junit.platform.commons.support.scanning.ClasspathScanner; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java index 50c04fe04347..c1bf5a32b6a3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java @@ -186,24 +186,24 @@ void throwsExceptionOnInvalidStringForPrimitiveTypes() { void throwsExceptionWhenImplicitConverstionIsUnsupported() { assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert("foo", Enigma.class)) // - .withMessage("No built-in converter for source type java.lang.String and target type %s", + .withMessage("No registered or built-in converter for source type java.lang.String and target type %s", Enigma.class.getName()); assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert(new Enigma(), int[].class)) // - .withMessage("No built-in converter for source type %s and target type int[]", Enigma.class.getName()); + .withMessage("No registered or built-in converter for source type %s and target type int[]", Enigma.class.getName()); assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert(new long[] {}, int[].class)) // - .withMessage("No built-in converter for source type long[] and target type int[]"); + .withMessage("No registered or built-in converter for source type long[] and target type int[]"); assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert(new String[] {}, boolean.class)) // - .withMessage("No built-in converter for source type java.lang.String[] and target type boolean"); + .withMessage("No registered or built-in converter for source type java.lang.String[] and target type boolean"); assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert(Class.class, int[].class)) // - .withMessage("No built-in converter for source type java.lang.Class and target type int[]"); + .withMessage("No registered or built-in converter for source type java.lang.Class and target type int[]"); } /** diff --git a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt index 11e66a7ca44f..89889df45d09 100644 --- a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt +++ b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt @@ -9,6 +9,7 @@ requires java.base mandated requires java.logging requires java.management requires org.apiguardian.api static transitive +uses org.junit.platform.commons.support.conversion.ConversionService uses org.junit.platform.commons.support.scanning.ClasspathScanner qualified exports org.junit.platform.commons.logging to org.junit.jupiter.api org.junit.jupiter.engine org.junit.jupiter.migrationsupport org.junit.jupiter.params org.junit.platform.console org.junit.platform.engine org.junit.platform.launcher org.junit.platform.reporting org.junit.platform.runner org.junit.platform.suite.api org.junit.platform.suite.engine org.junit.platform.testkit org.junit.vintage.engine qualified exports org.junit.platform.commons.util to org.junit.jupiter.api org.junit.jupiter.engine org.junit.jupiter.migrationsupport org.junit.jupiter.params org.junit.platform.console org.junit.platform.engine org.junit.platform.launcher org.junit.platform.reporting org.junit.platform.runner org.junit.platform.suite.api org.junit.platform.suite.commons org.junit.platform.suite.engine org.junit.platform.testkit org.junit.vintage.engine