diff --git a/core-java-modules/core-java-string-operations-8/pom.xml b/core-java-modules/core-java-string-operations-8/pom.xml
index de93718ae6..0b6cdc6b2f 100644
--- a/core-java-modules/core-java-string-operations-8/pom.xml
+++ b/core-java-modules/core-java-string-operations-8/pom.xml
@@ -19,6 +19,12 @@
commons-lang3
${apache.commons.lang3.version}
+
+ org.apache.storm
+ storm-core
+ 1.2.2
+ test
+
diff --git a/core-java-modules/core-java-string-operations-8/src/test/java/com/baeldung/EOLNormalizer/EOLNormalizerUnitTest.java b/core-java-modules/core-java-string-operations-8/src/test/java/com/baeldung/EOLNormalizer/EOLNormalizerUnitTest.java
new file mode 100644
index 0000000000..caeea60da1
--- /dev/null
+++ b/core-java-modules/core-java-string-operations-8/src/test/java/com/baeldung/EOLNormalizer/EOLNormalizerUnitTest.java
@@ -0,0 +1,34 @@
+package com.baeldung.EOLNormalizer;
+
+import org.apache.storm.shade.org.apache.commons.lang.StringUtils;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+import static org.junit.Assert.assertEquals;
+
+public class EOLNormalizerUnitTest {
+ String originalText = "This is a text\rwith different\r\nEOL characters\n";
+ String expectedText = "This is a text" + System.getProperty("line.separator") + "with different" + System.getProperty("line.separator") +
+ "EOL characters" + System.getProperty("line.separator");
+
+ @Test
+ public void givenText_whenUsingStringReplace_thenEOLNormalized() {
+ String normalizedText = originalText.replaceAll("\\r\\n|\\r|\\n", System.getProperty("line.separator"));
+ assertEquals(expectedText, normalizedText);
+ }
+
+ @Test
+ public void givenText_whenUsingStringUtils_thenEOLNormalized() {
+ String normalizedText = StringUtils.replaceEach(originalText, new String[]{"\r\n", "\r", "\n"}, new String[]{System.getProperty("line.separator"), System.getProperty("line.separator"), System.getProperty("line.separator")});
+ assertEquals(expectedText, normalizedText);
+ }
+
+ @Test
+ public void givenText_whenUsingStreamAPI_thenEOLNormalized() {
+ String normalizedText = Arrays.stream(originalText.split("\\r\\n|\\r|\\n"))
+ .collect(Collectors.joining(System.getProperty("line.separator"))).trim();
+ assertEquals(expectedText.trim(), normalizedText);
+ }
+}