diff --git a/core-groovy-strings/README.md b/core-groovy-strings/README.md
deleted file mode 100644
index e3202e2dd0..0000000000
--- a/core-groovy-strings/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Core Groovy Strings
-
-This module contains articles about core Groovy strings concepts
-
-## Relevant articles:
-
-- [Remove prefix in Groovy]()
-- [[<-- Prev]](/core-groovy-strings)
diff --git a/core-groovy-strings/pom.xml b/core-groovy-strings/pom.xml
index 059b53662c..1144d748ee 100644
--- a/core-groovy-strings/pom.xml
+++ b/core-groovy-strings/pom.xml
@@ -3,70 +3,120 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- com.baeldung
4.0.0
core-groovy-strings
1.0-SNAPSHOT
core-groovy-strings
jar
-
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
org.codehaus.groovy
- groovy-all
+ groovy
${groovy.version}
+
+
+ org.codehaus.groovy
+ groovy-all
+ ${groovy-all.version}
pom
+
+ org.codehaus.groovy
+ groovy-dateutil
+ ${groovy.version}
+
+
+ org.codehaus.groovy
+ groovy-sql
+ ${groovy-sql.version}
+
org.junit.platform
junit-platform-runner
${junit.platform.version}
test
+
+ org.hsqldb
+ hsqldb
+ ${hsqldb.version}
+ test
+
+
+ org.spockframework
+ spock-core
+ ${spock-core.version}
+ test
+
- src/main/groovy
- src/main/java
- org.codehaus.groovy
- groovy-eclipse-compiler
- ${groovy.compiler.version}
- true
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ ${gmavenplus-plugin.version}
+
+
+
+ addSources
+ addTestSources
+ compile
+ compileTests
+
+
+
- maven-compiler-plugin
- ${compiler.plugin.version}
-
- groovy-eclipse-compiler
-
- ${java.version}
-
+ maven-failsafe-plugin
+ ${maven-failsafe-plugin.version}
- org.codehaus.groovy
- groovy-eclipse-compiler
- ${groovy.compiler.version}
-
-
- org.codehaus.groovy
- groovy-eclipse-batch
- ${groovy.version}-01
+ org.junit.platform
+ junit-platform-surefire-provider
+ ${junit.platform.version}
+
+
+ junit5
+
+ integration-test
+ verify
+
+
+
+ **/*Test5.java
+
+
+
+
-
+
+
+
+ central
+ https://jcenter.bintray.com
+
+
+
1.0.0
- 1.1.3
- 2.5.7
- 2.20.1
- 3.8.0
- 3.3.0-01
- 1.8
+ 2.5.6
+ 2.5.6
+ 2.5.6
+ 2.4.0
+ 1.1-groovy-2.4
+ 1.6
-
+
\ No newline at end of file
diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy
index aa9e65d98d..4cdcb4ddfa 100644
--- a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy
+++ b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy
@@ -9,23 +9,28 @@ class RemovePrefixTest {
@Test
public void whenCasePrefixIsRemoved_thenReturnTrue() {
def trimPrefix = {
- it.startsWith('Groovy') ? it.minus('Groovy') : it
+ it.startsWith('Groovy-') ? it.minus('Groovy-') : it
}
+
+ def actual = trimPrefix("Groovy-Tutorials at Baeldung")
+ def expected = "Tutorials at Baeldung"
- Assert.assertEquals(trimPrefix("GroovyTutorials at Baeldung"), "Tutorials at Baeldung")
+ Assert.assertEquals(expected, actual)
}
@Test
- public void whenPrefixIsRemovedWithIgnoreCase_thenReturnTrue() {
+ public void whenPrefixIsRemoved_thenReturnTrue() {
String prefix = "groovy-"
String trimPrefix = "Groovy-Tutorials at Baeldung"
- def result;
+ def actual;
if(trimPrefix.startsWithIgnoreCase(prefix)) {
- result = trimPrefix.substring(prefix.length())
+ actual = trimPrefix.substring(prefix.length())
}
+
+ def expected = "Tutorials at Baeldung"
- Assert.assertEquals("Tutorials at Baeldung", result)
+ Assert.assertEquals(expected, actual)
}
@Test
@@ -33,26 +38,32 @@ class RemovePrefixTest {
def regex = ~"^([Gg])roovy-"
String trimPrefix = "Groovy-Tutorials at Baeldung"
- String result = trimPrefix - regex
+ String actual = trimPrefix - regex
+
+ def expected = "Tutorials at Baeldung"
- Assert.assertEquals("Tutorials at Baeldung", result)
+ Assert.assertEquals(expected, actual)
}
@Test public void whenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() {
def regex = ~"^groovy"
String trimPrefix = "groovyTutorials at Baeldung's groovy page"
- String result = trimPrefix.replaceFirst(regex, "")
+ String actual = trimPrefix.replaceFirst(regex, "")
- Assert.assertEquals("Tutorials at Baeldung's groovy page", result)
+ def expected = "Tutorials at Baeldung's groovy page"
+
+ Assert.assertEquals(expected, actual)
}
@Test
public void whenPrefixIsRemovedUsingReplaceAll_thenReturnTrue() {
String trimPrefix = "groovyTutorials at Baeldung groovy"
- String result = trimPrefix.replaceAll(/^groovy/, "")
+ String actual = trimPrefix.replaceAll(/^groovy/, "")
+
+ def expected = "Tutorials at Baeldung groovy"
- Assert.assertEquals("Tutorials at Baeldung groovy", result)
+ Assert.assertEquals(expected, actual)
}
-}
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ffdfe4cffa..f43318bcaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -383,6 +383,7 @@
core-groovy
core-groovy-2
core-groovy-collections
+ core-groovy-strings
core-java-modules
core-kotlin-modules
@@ -898,6 +899,7 @@
core-groovy
core-groovy-2
core-groovy-collections
+ core-groovy-strings
core-java-modules
core-kotlin-modules