Skip to content

Commit d0b2d79

Browse files
authored
Chore: fix loops which can be collapsed into a single Collection.removeIf() call in tests
1 parent ea7b6de commit d0b2d79

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

modules/flowable-engine/src/test/java/org/flowable/engine/test/api/event/DatabaseEventLoggerTest.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.io.IOException;
1919
import java.util.HashMap;
20-
import java.util.Iterator;
2120
import java.util.List;
2221
import java.util.Map;
2322

@@ -83,13 +82,7 @@ public void testDatabaseEvents() throws IOException {
8382
List<EventLogEntry> eventLogEntries = managementService.getEventLogEntries(null, null);
8483

8584
String processDefinitionId = processInstance.getProcessDefinitionId();
86-
Iterator<EventLogEntry> iterator = eventLogEntries.iterator();
87-
while (iterator.hasNext()) {
88-
EventLogEntry entry = iterator.next();
89-
if (entry.getProcessDefinitionId() != null && !entry.getProcessDefinitionId().equals(processDefinitionId)) {
90-
iterator.remove();
91-
}
92-
}
85+
eventLogEntries.removeIf(entry -> entry.getProcessDefinitionId() != null && !entry.getProcessDefinitionId().equals(processDefinitionId));
9386

9487
assertThat(eventLogEntries).hasSize(15);
9588

@@ -501,13 +494,7 @@ public void testDatabaseEventsNoTenant() throws IOException {
501494
List<EventLogEntry> eventLogEntries = managementService.getEventLogEntries(null, null);
502495

503496
String processDefinitionId = processInstance.getProcessDefinitionId();
504-
Iterator<EventLogEntry> iterator = eventLogEntries.iterator();
505-
while (iterator.hasNext()) {
506-
EventLogEntry entry = iterator.next();
507-
if (entry.getProcessDefinitionId() != null && !entry.getProcessDefinitionId().equals(processDefinitionId)) {
508-
iterator.remove();
509-
}
510-
}
497+
eventLogEntries.removeIf(entry -> entry.getProcessDefinitionId() != null && !entry.getProcessDefinitionId().equals(processDefinitionId));
511498

512499
assertThat(eventLogEntries).hasSize(15);
513500

0 commit comments

Comments
 (0)