From a628585ea5a78b0579b32c897d7c9b4177285b42 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Sat, 16 Dec 2023 21:41:02 +0100 Subject: [PATCH] Escape slashes following openrewrite/rewrite-templating#39 (#379) See also: - openrewrite/rewrite-templating#39 - openrewrite/rewrite-templating#44 --- .../apache/maven/shared/MavenSharedStringUtilsTest.java | 4 ++-- .../openrewrite/codehaus/plexus/PlexusStringUtilsTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/openrewrite/apache/maven/shared/MavenSharedStringUtilsTest.java b/src/test/java/org/openrewrite/apache/maven/shared/MavenSharedStringUtilsTest.java index 6ae099d..746e3e8 100644 --- a/src/test/java/org/openrewrite/apache/maven/shared/MavenSharedStringUtilsTest.java +++ b/src/test/java/org/openrewrite/apache/maven/shared/MavenSharedStringUtilsTest.java @@ -87,7 +87,7 @@ void bar(String in, CharSequence cs) { string = in == null || in.isEmpty() ? in : Character.toTitleCase(in.charAt(0)) + in.substring(1); string = Objects.toString(in, ""); string = Objects.toString(in, "nil"); - string = in.replaceAll("\\s+", ""); + string = in.replaceAll("\\\\s+", ""); bool = in == null ? false : in.equalsIgnoreCase("other"); bool = Objects.equals(in, "other"); @@ -97,7 +97,7 @@ void bar(String in, CharSequence cs) { string = in == null ? null : in.toLowerCase(); string = in == null || in.isEmpty() ? in : in.replace("search", "replacement"); string = in == null ? null : new StringBuffer(in).reverse().toString(); - array = in.split("\\s+"); + array = in.split("\\\\s+"); string = in == null ? null : in.trim(); string = in == null ? null : in.trim(); string = in == null ? null : in.toUpperCase(); diff --git a/src/test/java/org/openrewrite/codehaus/plexus/PlexusStringUtilsTest.java b/src/test/java/org/openrewrite/codehaus/plexus/PlexusStringUtilsTest.java index d66914e..9b3b7ff 100644 --- a/src/test/java/org/openrewrite/codehaus/plexus/PlexusStringUtilsTest.java +++ b/src/test/java/org/openrewrite/codehaus/plexus/PlexusStringUtilsTest.java @@ -90,7 +90,7 @@ void bar(String in, CharSequence cs) { string = in == null || in.isEmpty() ? in : Character.toTitleCase(in.charAt(0)) + in.substring(1); string = Objects.toString(in, ""); string = Objects.toString(in, "nil"); - string = in.replaceAll("\\s+", ""); + string = in.replaceAll("\\\\s+", ""); bool = in == null ? false : in.equalsIgnoreCase("other"); bool = Objects.equals(in, "other"); @@ -103,7 +103,7 @@ void bar(String in, CharSequence cs) { string = in == null ? null : in.toLowerCase(); string = in == null || in.isEmpty() ? in : in.replace("search", "replacement"); string = in == null ? null : new StringBuilder(in).reverse().toString(); - array = in.split("\\s+"); + array = in.split("\\\\s+"); string = in == null ? null : in.trim(); string = in == null ? null : in.trim(); string = in == null ? null : in.toUpperCase();