From fee9cc8d632ffecd78e78dfa395422079ed3fa05 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 25 Aug 2021 10:22:39 +0300 Subject: [PATCH] Fix quarkus.test.arg-line multiple args handling The split is intended to happen on a whitespace character, not the comma character used by properties Fixes: #19623 (cherry picked from commit 1982c8bc089e456ab932eba79de32afa4970f18f) --- .../test/junit/launcher/ConfigUtil.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher/ConfigUtil.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher/ConfigUtil.java index 97ed503bea78b..143c160eb4e02 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher/ConfigUtil.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher/ConfigUtil.java @@ -16,21 +16,22 @@ private ConfigUtil() { } public static List argLineValue(Config config) { - List strings = config.getOptionalValues("quarkus.test.arg-line", String.class) - .orElse(config.getOptionalValues("quarkus.test.argLine", String.class) // legacy value - .orElse(Collections.emptyList())); - if (strings.isEmpty()) { - return strings; + String strValue = config.getOptionalValue("quarkus.test.arg-line", String.class) + .orElse(config.getOptionalValue("quarkus.test.argLine", String.class) // legacy value + .orElse(null)); + if (strValue == null) { + return Collections.emptyList(); } - List sanitizedString = new ArrayList<>(strings.size()); - for (String s : strings) { + String[] parts = strValue.split("\\s+"); + List result = new ArrayList<>(parts.length); + for (String s : parts) { String trimmed = s.trim(); if (trimmed.isEmpty()) { continue; } - sanitizedString.add(trimmed); + result.add(trimmed); } - return sanitizedString; + return result; } public static Duration waitTimeValue(Config config) {