mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No functional change - refactor internal toStream() to use closure rather than explicit Runnable type for closing the stream
Conceptually javac closure might be better than an extra explicit type here
This commit is contained in:
@@ -39,9 +39,7 @@ public class TestQueryFindStream extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void findLargeStream_basic() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
try (Stream<Customer> stream = DB.find(Customer.class)
|
||||
.findLargeStream()) {
|
||||
|
||||
@@ -61,8 +59,16 @@ public class TestQueryFindStream extends BaseTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void manualTest_findSteam_when_streamNotClosed_connectionLeak() {
|
||||
public void manualTest_findSteam_when_closeWithResources() {
|
||||
// confirm manually the stream is closed via try with resources block
|
||||
try (Stream<Customer> stream = DB.find(Customer.class).findStream()) {
|
||||
// silly assert
|
||||
assertThat(stream.hashCode()).isNotZero();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void manualTest_findSteam_when_streamNotClosed_connectionLeak() {
|
||||
Stream<Customer> stream = DB.find(Customer.class).findStream();
|
||||
// remember a steam MUST be closed or we leak resources
|
||||
// comment out the close(); below to leak a connection
|
||||
|
||||
Reference in New Issue
Block a user