|
31 | 31 | import java.util.Map; |
32 | 32 | import java.util.Objects; |
33 | 33 | import java.util.Set; |
34 | | -import java.util.stream.Collectors; |
35 | 34 |
|
36 | 35 | import static java.lang.Integer.parseInt; |
37 | 36 | import static org.junit.Assert.assertEquals; |
@@ -270,16 +269,21 @@ public void checkAuditEventValuesForTransactionId(String containerPath, AuditEve |
270 | 269 | { |
271 | 270 | List<Map<String, Object>> events = getAuditLogsForTransactionId(containerPath, auditEventName, columnNames, transactionId, ContainerFilter.CurrentAndSubfolders); |
272 | 271 |
|
273 | | - Set<String> keysOfInterest = expectedValues.getFirst().keySet(); |
274 | | - List<Map<String, Object>> actualFiltered = events.stream() |
275 | | - .map(row -> row.entrySet().stream() |
276 | | - .filter(e -> keysOfInterest.contains(e.getKey())) |
277 | | - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))) |
| 272 | + List<Map<String, Object>> unmatched = expectedValues.stream() |
| 273 | + .filter(expectedRow -> { |
| 274 | + Set<String> keysOfInterest = expectedRow.keySet(); |
| 275 | + return events.stream().noneMatch(actualRow -> { |
| 276 | + Map<String, Object> actualFiltered = actualRow.entrySet().stream() |
| 277 | + .filter(e -> keysOfInterest.contains(e.getKey())) |
| 278 | + .collect(HashMap::new, |
| 279 | + (m, e) -> m.put(e.getKey(), e.getValue()), |
| 280 | + HashMap::putAll); |
| 281 | + return actualFiltered.equals(expectedRow); |
| 282 | + }); |
| 283 | + }) |
278 | 284 | .toList(); |
279 | 285 |
|
280 | | - assertEquals("Lists do not contain the same entries", |
281 | | - new HashSet<>(actualFiltered), new HashSet<>(expectedValues)); |
282 | | - |
| 286 | + assertTrue("Expected rows with no match in actual: " + unmatched, unmatched.isEmpty()); |
283 | 287 | } |
284 | 288 |
|
285 | 289 | public Map<String, Object> getTransactionAuditLogDetails(Integer transactionAuditId) |
|
0 commit comments