From 601275a5c99c2b930afcfca9daf2ddb79568a6da Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Wed, 13 Sep 2023 15:39:17 +0100 Subject: [PATCH 1/6] BAEL-6811 Check if letter is emoji example code --- .../core-java-string-algorithms-3/pom.xml | 10 +++++ .../findemojis/FindEmojisUnitTest.java | 44 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml index 7d4adeba92..1122cbec6d 100644 --- a/core-java-modules/core-java-string-algorithms-3/pom.xml +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -23,6 +23,16 @@ commons-lang3 ${apache-commons-lang3.version} + + com.kcthota + emoji4j + 6.0 + + + com.vdurmont + emoji-java + 5.1.1 + diff --git a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java new file mode 100644 index 0000000000..2400e052b3 --- /dev/null +++ b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.findemojis; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.vdurmont.emoji.EmojiManager; + +import emoji4j.EmojiUtils; + +public class FindEmojisUnitTest { + + @Test + public void givenAWord_whenUsingEmoji4J_thenDetectEmoji() { + boolean emoji = EmojiUtils.isEmoji("\uD83D\uDC3B"); + assertTrue(emoji); + + boolean notEmoji = EmojiUtils.isEmoji("w"); + assertFalse(notEmoji); + } + + @Test + public void givenAWord_whenUsingEmojiJava_thenDetectEmoji() { + boolean emoji = EmojiManager.isEmoji("\uD83D\uDC3B"); + assertTrue(emoji); + + boolean notEmoji = EmojiManager.isEmoji("w"); + assertFalse(notEmoji); + } + + @Test + public void givenAWord_whenUsingRegex_thenDetectEmoji() { + String regexPattern = "[\uD800-\uDBFF\uDC00-\uDFFF]+"; + String emojiString = "\uD83D\uDC3B"; + boolean emoji = emojiString.matches(regexPattern); + assertTrue(emoji); + + String notEmojiString = "w"; + boolean notEmoji = notEmojiString.matches(regexPattern); + assertFalse(notEmoji); + } + +} From 1fe064e7438c317e4db45486da494ee0697c1ef1 Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Thu, 14 Sep 2023 15:06:43 +0100 Subject: [PATCH 2/6] BAEL-6811 Move folders --- .../core-java-string-algorithms-3/pom.xml | 10 ---------- core-java-modules/core-java-string-algorithms/pom.xml | 7 +++++++ .../com/baeldung/findemojis/FindEmojisUnitTest.java | 0 3 files changed, 7 insertions(+), 10 deletions(-) rename core-java-modules/{core-java-string-algorithms-3 => core-java-string-algorithms}/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java (100%) diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml index 1122cbec6d..7d4adeba92 100644 --- a/core-java-modules/core-java-string-algorithms-3/pom.xml +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -23,16 +23,6 @@ commons-lang3 ${apache-commons-lang3.version} - - com.kcthota - emoji4j - 6.0 - - - com.vdurmont - emoji-java - 5.1.1 - diff --git a/core-java-modules/core-java-string-algorithms/pom.xml b/core-java-modules/core-java-string-algorithms/pom.xml index 10d28feb2f..ad1124474a 100644 --- a/core-java-modules/core-java-string-algorithms/pom.xml +++ b/core-java-modules/core-java-string-algorithms/pom.xml @@ -39,6 +39,11 @@ emoji-java ${emoji-java.version} + + com.kcthota + emoji4j + 6.0 + @@ -52,6 +57,8 @@ + 8 + 8 0.4.0 4.0.0 diff --git a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java b/core-java-modules/core-java-string-algorithms/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java similarity index 100% rename from core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java rename to core-java-modules/core-java-string-algorithms/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java From 39f235d8baf8a506f1048ec092e198436dca5938 Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Thu, 14 Sep 2023 15:56:39 +0100 Subject: [PATCH 3/6] Revert "BAEL-6811 Move folders" This reverts commit 1fe064e7438c317e4db45486da494ee0697c1ef1. --- .../core-java-string-algorithms-3/pom.xml | 10 ++++++++++ .../com/baeldung/findemojis/FindEmojisUnitTest.java | 0 core-java-modules/core-java-string-algorithms/pom.xml | 7 ------- 3 files changed, 10 insertions(+), 7 deletions(-) rename core-java-modules/{core-java-string-algorithms => core-java-string-algorithms-3}/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java (100%) diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml index 7d4adeba92..1122cbec6d 100644 --- a/core-java-modules/core-java-string-algorithms-3/pom.xml +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -23,6 +23,16 @@ commons-lang3 ${apache-commons-lang3.version} + + com.kcthota + emoji4j + 6.0 + + + com.vdurmont + emoji-java + 5.1.1 + diff --git a/core-java-modules/core-java-string-algorithms/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java similarity index 100% rename from core-java-modules/core-java-string-algorithms/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java rename to core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java diff --git a/core-java-modules/core-java-string-algorithms/pom.xml b/core-java-modules/core-java-string-algorithms/pom.xml index ad1124474a..10d28feb2f 100644 --- a/core-java-modules/core-java-string-algorithms/pom.xml +++ b/core-java-modules/core-java-string-algorithms/pom.xml @@ -39,11 +39,6 @@ emoji-java ${emoji-java.version} - - com.kcthota - emoji4j - 6.0 - @@ -57,8 +52,6 @@ - 8 - 8 0.4.0 4.0.0 From 913f8f55005f3b1cf6fc719f8b22390afff7ce40 Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Thu, 14 Sep 2023 16:03:19 +0100 Subject: [PATCH 4/6] BAEL-6811 remove emoji4j usage --- core-java-modules/core-java-string-algorithms-3/pom.xml | 5 ----- .../java/com/baeldung/findemojis/FindEmojisUnitTest.java | 9 --------- 2 files changed, 14 deletions(-) diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml index 1122cbec6d..9c704c9f40 100644 --- a/core-java-modules/core-java-string-algorithms-3/pom.xml +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -23,11 +23,6 @@ commons-lang3 ${apache-commons-lang3.version} - - com.kcthota - emoji4j - 6.0 - com.vdurmont emoji-java diff --git a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java index 2400e052b3..2c1a43fdaa 100644 --- a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java +++ b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java @@ -11,15 +11,6 @@ import emoji4j.EmojiUtils; public class FindEmojisUnitTest { - @Test - public void givenAWord_whenUsingEmoji4J_thenDetectEmoji() { - boolean emoji = EmojiUtils.isEmoji("\uD83D\uDC3B"); - assertTrue(emoji); - - boolean notEmoji = EmojiUtils.isEmoji("w"); - assertFalse(notEmoji); - } - @Test public void givenAWord_whenUsingEmojiJava_thenDetectEmoji() { boolean emoji = EmojiManager.isEmoji("\uD83D\uDC3B"); From f0719f76a7762d67774c37a41d4d3d70dd17bc9d Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Thu, 14 Sep 2023 16:09:18 +0100 Subject: [PATCH 5/6] BAEL-6811 remove unused import --- .../test/java/com/baeldung/findemojis/FindEmojisUnitTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java index 2c1a43fdaa..3cd5b1ba97 100644 --- a/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java +++ b/core-java-modules/core-java-string-algorithms-3/src/test/java/com/baeldung/findemojis/FindEmojisUnitTest.java @@ -7,8 +7,6 @@ import org.junit.Test; import com.vdurmont.emoji.EmojiManager; -import emoji4j.EmojiUtils; - public class FindEmojisUnitTest { @Test From 39f5f3cdd745dbec6f14356b07e5f7636b847763 Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Mon, 18 Sep 2023 10:41:36 +0100 Subject: [PATCH 6/6] BAEL-6811 extract dependecy version number --- core-java-modules/core-java-string-algorithms-3/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml index 9c704c9f40..536175acc2 100644 --- a/core-java-modules/core-java-string-algorithms-3/pom.xml +++ b/core-java-modules/core-java-string-algorithms-3/pom.xml @@ -26,7 +26,7 @@ com.vdurmont emoji-java - 5.1.1 + ${emoji-java.version} @@ -57,6 +57,7 @@ 11 1.7 3.12.0 + 5.1.1 \ No newline at end of file