Skip to content

Commit 535aff0

Browse files
committed
Apply review
1 parent c0687a6 commit 535aff0

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
package org.junit.platform.commons.support.conversion;
1212

13+
import static org.apiguardian.api.API.Status.DEPRECATED;
1314
import static org.apiguardian.api.API.Status.EXPERIMENTAL;
1415

1516
import java.util.ServiceLoader;
@@ -52,6 +53,7 @@ private ConversionSupport() {
5253
*/
5354
@SuppressWarnings("unchecked")
5455
@Deprecated
56+
@API(status = DEPRECATED, since = "5.12")
5557
public static <T> T convert(String source, Class<T> targetType, ClassLoader classLoader) {
5658
return (T) DefaultConversionService.INSTANCE.convert(source, targetType, getClassLoader(classLoader));
5759
}
@@ -84,7 +86,7 @@ public static <T> T convert(Object source, Class<T> targetType, ClassLoader clas
8486
.filter(candidate -> candidate.canConvert(source, targetType, classLoader)) //
8587
.findFirst() //
8688
.map(candidate -> candidate.convert(source, targetType, classLoaderToUse)) //
87-
.orElseThrow(() -> new ConversionException("No built-in converter for source type "
89+
.orElseThrow(() -> new ConversionException("No registered or built-in converter for source type "
8890
+ source.getClass().getTypeName() + " and target type " + targetType.getTypeName()));
8991
}
9092

junit-platform-commons/src/module/org.junit.platform.commons/module-info.java

+1
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
org.junit.platform.suite.engine,
5454
org.junit.platform.testkit,
5555
org.junit.vintage.engine;
56+
uses org.junit.platform.commons.support.conversion.ConversionService;
5657
uses org.junit.platform.commons.support.scanning.ClasspathScanner;
5758
}

jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,27 @@ void throwsExceptionOnInvalidStringForPrimitiveTypes() {
186186
void throwsExceptionWhenImplicitConverstionIsUnsupported() {
187187
assertThatExceptionOfType(ArgumentConversionException.class) //
188188
.isThrownBy(() -> convert("foo", Enigma.class)) //
189-
.withMessage("No built-in converter for source type java.lang.String and target type %s",
189+
.withMessage("No built-in converter for source type java.lang.String and target type %s", // FIXME enhance DefaultConversionService::canConvert
190190
Enigma.class.getName());
191191

192192
assertThatExceptionOfType(ArgumentConversionException.class) //
193193
.isThrownBy(() -> convert(new Enigma(), int[].class)) //
194-
.withMessage("No built-in converter for source type %s and target type int[]", Enigma.class.getName());
194+
.withMessage("No registered or built-in converter for source type %s and target type int[]",
195+
Enigma.class.getName());
195196

196197
assertThatExceptionOfType(ArgumentConversionException.class) //
197198
.isThrownBy(() -> convert(new long[] {}, int[].class)) //
198-
.withMessage("No built-in converter for source type long[] and target type int[]");
199+
.withMessage("No registered or built-in converter for source type long[] and target type int[]");
199200

200201
assertThatExceptionOfType(ArgumentConversionException.class) //
201202
.isThrownBy(() -> convert(new String[] {}, boolean.class)) //
202-
.withMessage("No built-in converter for source type java.lang.String[] and target type boolean");
203+
.withMessage(
204+
"No registered or built-in converter for source type java.lang.String[] and target type boolean");
203205

204206
assertThatExceptionOfType(ArgumentConversionException.class) //
205207
.isThrownBy(() -> convert(Class.class, int[].class)) //
206-
.withMessage("No built-in converter for source type java.lang.Class and target type int[]");
208+
.withMessage(
209+
"No registered or built-in converter for source type java.lang.Class and target type int[]");
207210
}
208211

209212
/**

platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ requires java.base mandated
99
requires java.logging
1010
requires java.management
1111
requires org.apiguardian.api static transitive
12+
uses org.junit.platform.commons.support.conversion.ConversionService
1213
uses org.junit.platform.commons.support.scanning.ClasspathScanner
1314
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
1415
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

0 commit comments

Comments
 (0)