Closed GoogleCodeExporter closed 9 years ago
Not sure what the problem is, but it doesn't sound like a problem on Spock's
side. Maybe your build or terminal has the wrong character encoding set.
Original comment by pnied...@gmail.com
on 20 Nov 2013 at 9:03
What do you need to be sure? I work on Win7 Pro, German edition. The problem
appears with Maven on all four consoles tested: Git Bash, cmd.exe, Cygwin Bash,
IntelliJ IDEA internal console output. Actually there should be some way to
specify the encoding on Maven, maybe as a config parameter of the spock
dependency or the gmaven plugin.
Original comment by alexande...@googlemail.com
on 20 Nov 2013 at 1:13
No, sorry, my mistake. Win7 Pro in English edition, not German. I tested at
work, not at home, my mistake.
Original comment by alexande...@googlemail.com
on 20 Nov 2013 at 1:14
I am sure because Spock doesn't get to choose any encoding. (It's not even
responsible for printing the message to standard out.) I'm not sure it's an
encoding problem, because that normally manifests differently. Nevertheless,
I'd check the encoding used by the JVM that's running the tests
(`file.encoding` system property), and the encoding used by your terminal.
Original comment by pnied...@gmail.com
on 21 Nov 2013 at 4:50
So now you are sure? I asked because earlier you wrote:
> Not sure what the problem is
Anyway, on all 4 consoles mentioned earlier all other types of output - and
Maven as well as the Java program itself produce a lot of them during testing -
are perfectly okay, i.e. commas and other special characters are printed
exactly the right way. I do not say it is Spock's fault. I am not looking for
culprits, just for a root cause and a way to fix it. I figured you know more
about your own tool than I do. Are you not interested in helping to fix
problems in Maven-driven projects, even though they might just affect you
indirectly? The "wasn't me" attitude helps nobody.
Original comment by alexande...@googlemail.com
on 21 Nov 2013 at 7:33
I'm not sure what the problem is, but I'm sure that it's not a problem on
Spock's side. That's a very important statement, because it allows you to
search for a cause in other places. I've already tried to help and provided
concrete directions. The nature of the problem isn't at all specific to Spock,
and I can't investigate your environment, so it's your job to find the cause
for this. Good luck.
PS: If you want someone else to have a closer look at your problem, a minimal
self-contained reproducible example helps tremendously. It also allows you to
run the example in other environments and check whether the problem exists
there too.
Original comment by pnied...@gmail.com
on 21 Nov 2013 at 7:59
More info: It happens both on Windows with Cp1252 and on Linux with UTF-8 on
the console. It is definitely a problem in decoding the output of Spock,
probably caused by some Maven plugin. Proof:
LINUX
-----
Failed tests: Calculation [-customer\u002C XXXXX](OrderGeneratorTest):
Unexpected call of System.exit(1).
Tests in error:
Calculation [-customer\u002C XXXXX](OrderGeneratorTest): Tried to exit with status 1.
Tests run: 65, Failures: 1, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
(...)
$ mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-12-generic", arch: "amd64", family: "unix"
WINDOWS
-------
Failed tests: Calculation [###\u002C ***](OrderGeneratorTest): Unexpected
call of System.exit(1).
Tests in error:
Calculation [###\u002C ***](OrderGeneratorTest): Tried to exit with status 1.
Tests run: 63, Failures: 1, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
(...)
$ mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19
14:51:28+0100)
Maven home: c:\Program Files\Java\apache-maven-3.0.5
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Original comment by alexande...@googlemail.com
on 21 Nov 2013 at 8:02
If you want to reproduce it, just clone
https://github.com/kriegaex/order-generator.git, then break one of the test
cases in order to provoke the test failure output for Spock.
Original comment by alexande...@googlemail.com
on 21 Nov 2013 at 8:04
I think this JUnit add-on produces the erroneous output:
<dependency>
<!-- JUnit 4.7+ rule ExpectedSystemExit for handling System.exit() in tests -->
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.3.1</version>
<scope>test</scope>
</dependency>
I am going to contact the author. Thanks for your help thus far.
Original comment by alexande...@googlemail.com
on 21 Nov 2013 at 8:12
Just for reference, if anyone else faces the same problem and wants to know how
the rest of the story goes: The issue ticket is
https://github.com/stefanbirkner/system-rules/issues/12.
Original comment by alexande...@googlemail.com
on 21 Nov 2013 at 8:19
The bug was caused by this bug in Maven Surefire Plugin:
http://jira.codehaus.org/browse/SUREFIRE-857
The default in Maven 3.1.1 is Surefire 2.12.4 which is fine. But with Maven
3.0.5 the plugin version is 2.10 as can be seen in the effective POM. So the
solution is to explicitly use a Surefire plugin version >= 2.12.3.
Original comment by alexande...@googlemail.com
on 30 Nov 2013 at 3:06
Original issue reported on code.google.com by
alexande...@googlemail.com
on 20 Nov 2013 at 8:54