diff --git a/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractDataProviderArgumentProvider.java b/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractDataProviderArgumentProvider.java index 4f2cb37c..f4da9c7a 100644 --- a/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractDataProviderArgumentProvider.java +++ b/junit-jupiter-params/src/main/java/com/tngtech/junit/dataprovider/AbstractDataProviderArgumentProvider.java @@ -69,36 +69,6 @@ protected Stream convertData(Method testMethod, Object data checkNotNull(data, "'data' must not be null"); checkNotNull(context, "'context' must not be null"); - return dataConverter.convert(data, testMethod.isVarArgs(), testMethod.getParameterTypes(), context).stream() - .map(objects -> { - Class[] parameterTypes = testMethod.getParameterTypes(); - for (int idx = 0; idx < objects.length; idx++) { - // TODO workaround for https://github.com/junit-team/junit5/issues/1092 - Class parameterType = parameterTypes[idx]; - if (parameterType.isPrimitive()) { - objects[idx] = convertToBoxedTypeAsWorkaroundForNotWorkingWideningAndUnboxingConversion( - objects[idx], parameterType); - } - } - return objects; - }).map(Arguments::of); - } - - private Object convertToBoxedTypeAsWorkaroundForNotWorkingWideningAndUnboxingConversion(Object result, - Class parameterType) { - if (short.class.equals(parameterType)) { - return ((Number) result).shortValue(); - } else if (byte.class.equals(parameterType)) { - return ((Number) result).byteValue(); - } else if (int.class.equals(parameterType)) { - return ((Number) result).intValue(); - } else if (long.class.equals(parameterType)) { - return ((Number) result).longValue(); - } else if (float.class.equals(parameterType)) { - return ((Number) result).floatValue(); - } else if (double.class.equals(parameterType)) { - return ((Number) result).doubleValue(); - } - return result; + return dataConverter.convert(data, testMethod.isVarArgs(), testMethod.getParameterTypes(), context).stream().map(Arguments::of); } } diff --git a/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/DataProviderParameterResolver.java b/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/DataProviderParameterResolver.java index 1419629e..d9098fbd 100644 --- a/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/DataProviderParameterResolver.java +++ b/junit-jupiter/src/main/java/com/tngtech/junit/dataprovider/DataProviderParameterResolver.java @@ -30,32 +30,6 @@ public boolean supportsParameter(ParameterContext parameterContext, ExtensionCon @Override public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - Object result = arguments.get(parameterContext.getIndex()); - - // TODO workaround for https://github.com/junit-team/junit5/issues/1092 - Class parameterType = parameterContext.getParameter().getType(); - if (parameterType.isPrimitive()) { - return convertToBoxedTypeAsWorkaroundForNotWorkingWideningAndUnboxingConversion(result, parameterType); - } - - return result; - } - - private Object convertToBoxedTypeAsWorkaroundForNotWorkingWideningAndUnboxingConversion(Object result, - Class parameterType) { - if (short.class.equals(parameterType)) { - return ((Number) result).shortValue(); - } else if (byte.class.equals(parameterType)) { - return ((Number) result).byteValue(); - } else if (int.class.equals(parameterType)) { - return ((Number) result).intValue(); - } else if (long.class.equals(parameterType)) { - return ((Number) result).longValue(); - } else if (float.class.equals(parameterType)) { - return ((Number) result).floatValue(); - } else if (double.class.equals(parameterType)) { - return ((Number) result).doubleValue(); - } - return result; + return arguments.get(parameterContext.getIndex()); } -} \ No newline at end of file +}