shivadorepally / junitparams

Automatically exported from code.google.com/p/junitparams
0 stars 0 forks source link

Should be possible to pass the null value as a parameter #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Prepare a method with parameters containing null.
2. Run a test using this method as the source of parameters.

What is the expected output? 
The test should run.

What do you see instead?
The stacktrace for NPE (attached).  

What version of the product are you using? On what operating system?
JUnitParams - 0.5.0
JUnit - 4.10

Original issue reported on code.google.com by rafalwi...@gmail.com on 2 Jun 2012 at 7:22

Attachments:

GoogleCodeExporter commented 8 years ago
This is not a problem of the runner (even if it looks as such) but of the data. 
Unfortunatelly $() method doesn't work nicely with nulls. As a workaround use 
normal new Object[] {null} when passing nulls and it works just fine.

Original comment by lipinski...@gmail.com on 16 Jun 2012 at 8:35

GoogleCodeExporter commented 8 years ago
I was hit by it again. I don't like to remember about workarounds. I had a look 
at the code.

You're correct. That's not a problem of the junitparams runner. Rather, a 
limitation of Java var-args. But it's reported by junitparams in a misleading 
way.

Nevertheless, the workaround could be moved from users code to the project 
itself. I've pushed it together with tests to a clone 
(http://code.google.com/r/rafalwicha-solving-issue-23/source/browse). I'm also 
attaching a throw-away project with null cases.

Could you please have a look at it and merge to the next release? I assure at 
least 10 users will be glad for it.

Original comment by rafalwi...@gmail.com on 10 Nov 2012 at 5:08

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by lipinski...@gmail.com on 14 Dec 2012 at 3:15