Closed g-fresh closed 10 years ago
How do you execute the test? Which Java and which JUnit version do you use? I cannot reproduce the problem. It works for me in Eclipse and the gradle test runner with Java 1.7 and JUnit 4.8.2.
Hi @g-fresh, hi @janschaefer,
I cannot reproduce the Exception
in Eclipse Luna as well but I have the problem, that the JUnit plugin does not show the test result properly due to the newline in the last tests String
.
What I can imagine to avoid this is adding a special formatting for \t
, \n
, \r
(as ""
prints out <empty string>
instead of
:-)
Using ./gradlew build
having the above code integrated as test succeed as well and outputs readable test results.
I just reconsidered may former comment about IntelliJ IDEA and saw that I made a mistake. Actually there is no problem with IntelliJ and newlines character in test method descriptions (=> delete the former post with the stacktrace ...)
Hi @g-fresh,
I just tried to reproduce your bug again but still no sucess.
In your stacktrace above the IllegalArgumentException
is thrown in DataProviderFilter
. This means to me that you do not use the v1.9.2 of JUnit dataprovider as since v1.8.0 I have made DataProviderFilter
more failure tolerant such that it no longer throws any IllegalArgumentException
(see #27).
Moreover, if I look at any version between v1.4.0 and v1.5.2 the line 59f looks like this:
throw new IllegalArgumentException(String.format("Test method description %s is not suppored by %s.",
filter.describe(), this.getClass().getSimpleName()));
Furthermore, in every version between v1.4.0 and v1.7.0 I can reproduce your reported bug for the included test containing the newline character. It is thrown because the filter description does not match the corresponding pattern (which is rather logical as it contains a newline and the matcher does not recognize newlines with .
. To fix this one could just add the Pattern.DOTALL
flag to the pattern.
With #42 and the replacement of newlines with their printable companion, this would be no longer necessary to fix, but I think it is worth to fix. What do others think?
In version 1.9.2, using data a provider which produces strings containing newline, results in strange behavior.
Exampe:
Running the method separately (not the complete test case), you get:
Without the last parameter ("\n"), things work as expected.
Running the complete test case from the console, everythings works as expected. Running the complete test case from Eclipse, you don't get any test results, meaning: The JUnit view shows the list of tests, but reports 0/4 runs.