apache / apache/maven-surefire
[SUREFIRE-1814] Listener System.out.printf is written as multiple lines
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Dan Berindei](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=dan.berindei)** opened **[SUREFIRE-1814](https://issues.apache.org/jira/browse/SUREFIRE-1814?redirect=false)** and commented
Our project has a listener that writes progress information using ANSI escape codes. Perhaps in order to avoid the output being captured by Surefire, it saves `System.out` to a field in its constructor, and uses the saved `System.out` reference to output progress information.
Since 3.0.0-M4, surefire has started replacing `System.out` earlier, so now it also captures the output of the listener. This wouldn't be a problem, except the listener's `printf()` calls are now written across multiple lines. E.g.
```java
System.out.printf("a%2sb", "1");
```
prints this during a test:
```
a 1b
```
and this in the listener constructor:
```
a
1
b
```
I believe this is related to the POM using `classes` and `1`.
Here is a small project reproducing the issue:
https://github.com/danberindei/surefire-out-print-test
---
**Affects:** 3.0.0-M4, 3.0.0-M5
**Issue Links:**
- [SUREFIRE-2050](https://issues.apache.org/jira/browse/SUREFIRE-2050) Remove deprecated subclasses of ConcurrentRunListener after SUREFIRE-1661, SUREFIRE-1795, SUREFIRE-1643
Contributor guide
Research direction
Start with the linked sure-fire-out-print-test reproduction project and inspect the listener constructor, its saved System.out reference, and the POM settings for parallel classes and forkCount 1. Trace how Surefire captures listener output and verify the fix by reproducing the printf example, with each call remaining on one line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100