Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic class name to class object conversion #41

Closed
adammichalik opened this issue Apr 24, 2015 · 4 comments
Closed

Automatic class name to class object conversion #41

adammichalik opened this issue Apr 24, 2015 · 4 comments

Comments

@adammichalik
Copy link

JUnitParams supports most of the literals - numeric, enums, strings, but class names are not automatically converted:

    @Test
    @Parameters({"java.lang.Exception"})
    public void testException(Class<?> e) {...}

fails with

java.lang.IllegalArgumentException: Parameter type (java.lang.Class) cannot be handled! Only primitive types and Strings can be used.
    at junitparams.internal.InvokeParameterisedMethod.castParameterDirectly(InvokeParameterisedMethod.java:192)
    at junitparams.internal.InvokeParameterisedMethod.castAllParametersToProperTypes(InvokeParameterisedMethod.java:143)
    at junitparams.internal.InvokeParameterisedMethod.castParamsUsingConverters(InvokeParameterisedMethod.java:104)
    at junitparams.internal.InvokeParameterisedMethod.castParamsFromString(InvokeParameterisedMethod.java:45)

It would be nice to see that working :)

@michal-lipski
Copy link
Contributor

Totally agree. We are looking forward for your PR :)

@adammichalik
Copy link
Author

There you go :)

michal-lipski added a commit that referenced this issue Apr 24, 2015
…name_to_class_object_conversion

#41 Automatic class name to class object conversion
@michal-lipski
Copy link
Contributor

That was fast :)

@adammichalik
Copy link
Author

Well, it sounded line a challenge ;) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants