RFR 8159126 Add test to validate DriverManager.println output when DriverManager is initially loaded

Paul Sandoz paul.sandoz at oracle.com
Mon Sep 12 17:55:33 UTC 2016


> On 12 Sep 2016, at 10:15, Lance Andersen <lance.andersen at oracle.com> wrote:
>> 
>> Suggestion:
>> 
>>  70         try (BufferedReader reader = new BufferedReader(new CharArrayReader(cw.toCharArray()))) {
>>  71             boolean result
>>  72                     = reader.lines().anyMatch(
>>  73                             line -> line.matches(".*JDBC DriverManager initialized.*"));
>>  74             assertFalse(result);
>> 
>> 
>> Change anyMatch, to noneMatch, and assertTrue (note if the stream is empty none is “vacuously” satisfied and will return true).
> 
> Thank you Paul.  I can make that change, was not sure (if one was faster than the other)
> 

Both will short-circuiting when the predicate returns true, speed-wise it should not be an issue. Arguably, noneMatch better expresses the intent of that is being tested.

Paul.


More information about the core-libs-dev mailing list