From 884ef9c32f54bcb532f193e57ba6526f1126115f Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Mon, 30 Oct 2023 20:32:14 +0300 Subject: [PATCH] EPMRPP-87044 exclude empty statistics records from processing --- .../content/HealthCheckTableChain.java | 16 ++++++++-------- .../dao/WidgetContentRepositoryTest.java | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/dao/widget/healthcheck/content/HealthCheckTableChain.java b/src/main/java/com/epam/ta/reportportal/dao/widget/healthcheck/content/HealthCheckTableChain.java index 13bc4f6ff..fad08c033 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/widget/healthcheck/content/HealthCheckTableChain.java +++ b/src/main/java/com/epam/ta/reportportal/dao/widget/healthcheck/content/HealthCheckTableChain.java @@ -70,14 +70,14 @@ private List concat(boolean contentFirst, result.add(resultEntry); }); } else { - columnMapping.forEach((key, attributes) -> { - HealthCheckTableContent resultEntry = ofNullable(content.remove(key)).map( - statisticsContent -> entryFromStatistics(key, - statisticsContent - )).orElseGet(HealthCheckTableContent::new); - resultEntry.setCustomValues(attributes); - result.add(resultEntry); - }); + columnMapping.forEach((key, attributes) -> + ofNullable(content.remove(key)) + .map(statisticsContent -> entryFromStatistics(key, statisticsContent)) + .ifPresent(resultEntry -> { + resultEntry.setCustomValues(attributes); + result.add(resultEntry); + })); + content.forEach((key, statistics) -> result.add(entryFromStatistics(key, statistics))); } return result; diff --git a/src/test/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryTest.java b/src/test/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryTest.java index 53aa25035..682536a10 100644 --- a/src/test/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryTest.java +++ b/src/test/java/com/epam/ta/reportportal/dao/WidgetContentRepositoryTest.java @@ -1337,7 +1337,7 @@ void componentHealthCheckTable() { .of("first", "build", Sort.by(Sort.Direction.DESC, "customColumn"), true, new ArrayList<>())); - assertFalse(healthCheckTableContents.isEmpty()); + assertTrue(healthCheckTableContents.isEmpty()); initParams = HealthCheckTableInitParams.of("hello", com.google.common.collect.Lists.newArrayList("build")); @@ -1440,9 +1440,9 @@ void componentHealthCheckTableCompositeAttributeWithoutAny() { new ArrayList<>() )); - assertFalse(healthCheckTableContents.isEmpty()); + assertTrue(healthCheckTableContents.isEmpty()); widgetContentRepository.removeWidgetView(initParams.getViewName()); } -} \ No newline at end of file +}