java-docs-samples icon indicating copy to clipboard operation
java-docs-samples copied to clipboard

Correctly restore stdout after tests

Open chingor13 opened this issue 5 years ago • 5 comments

We have many tests that overwrite stdout with a custom output stream and we call System.setOut(null) to attempt to restore stdout.

We need to either:

  • capture the original System.out and restore that same instance
  • use StdOutCaptureRule provided by com.google.cloud:google-cloud-core's tests classifier (jar)

chingor13 avatar Dec 11 '20 20:12 chingor13

@chingor13, thank you for pointing this out. Here is the fix for this issue just in case somebody needs a reference.

b-loved-dreamer avatar Dec 14 '20 17:12 b-loved-dreamer

Closing this issue. It's used for reference in fixing this specific problem.

b-loved-dreamer avatar Jan 04 '21 16:01 b-loved-dreamer

I think there are a few other samples that still do this incorrectly, so I'm going to reopen so we don't forget about it.

kurtisvg avatar Jan 05 '21 21:01 kurtisvg

The next release of shared-config will have the rule setup.

lesv avatar Apr 05 '21 22:04 lesv

I'm going to close this, and we'll deal with individual issues and PR's for any of these we find.

lesv avatar Apr 05 '21 22:04 lesv