From d64c635e7141fd4b64d08f1b22c2329a5c2506cb Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Mon, 18 Mar 2024 15:09:05 +0000 Subject: [PATCH] pmd --- .../main/java/io/qameta/allure/karate/AllureKarate.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java b/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java index 79be5e9b..310d6c75 100644 --- a/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java +++ b/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java @@ -124,9 +124,12 @@ public boolean beforeScenario(final ScenarioRuntime sr) { } private static String getName(final Scenario scenario, final String defaultValue) { - return Objects.isNull(scenario.getName()) || scenario.getName().trim().isEmpty() - ? defaultValue - : scenario.getName().trim(); + if (Objects.isNull(scenario.getName())) { + return defaultValue; + } + final boolean blank = scenario.getName().chars() + .allMatch(Character::isWhitespace); + return blank ? defaultValue : scenario.getName().trim(); } @Override