diff --git a/core-groovy/build.gradle b/core-groovy/build.gradle
index b3f33836da..300827ee7c 100644
--- a/core-groovy/build.gradle
+++ b/core-groovy/build.gradle
@@ -8,6 +8,6 @@ repositories {
}
dependencies {
- compile 'org.codehaus.groovy:groovy-all:2.5.0-alpha-1'
+ compile 'org.codehaus.groovy:groovy-all:2.4.13'
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
}
diff --git a/core-groovy/pom.xml b/core-groovy/pom.xml
index 961a4ba125..91cbe66e35 100644
--- a/core-groovy/pom.xml
+++ b/core-groovy/pom.xml
@@ -23,17 +23,17 @@
org.codehaus.groovy
groovy
- 2.5.0-alpha-1
+ 2.4.13
org.codehaus.groovy
groovy-all
- 2.5.0-alpha-1
+ 2.4.13
org.codehaus.groovy
groovy-sql
- 2.5.0-alpha-1
+ 2.4.13
org.junit.jupiter
diff --git a/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy b/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy
index 0d7c451972..6cda7c6fbd 100644
--- a/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy
+++ b/core-groovy/src/main/groovy/com/baeldung/json/JsonParser.groovy
@@ -1,6 +1,5 @@
package com.baeldung.json
-import groovy.json.JsonGenerator
import groovy.json.JsonOutput
import groovy.json.JsonParserType
import groovy.json.JsonSlurper
@@ -21,14 +20,6 @@ class JsonParser {
JsonOutput.toJson(account)
}
- String toJson(Account account, String dateFormat, String... fieldsToExclude) {
- JsonGenerator generator = new JsonGenerator.Options()
- .dateFormat(dateFormat)
- .excludeFieldsByName(fieldsToExclude)
- .build()
- generator.toJson(account)
- }
-
String prettyfy(String json) {
JsonOutput.prettyPrint(json)
}
diff --git a/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy b/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy
index fcd51d58bc..c3842340a5 100644
--- a/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy
+++ b/core-groovy/src/test/groovy/com/baeldung/json/JsonParserTest.groovy
@@ -52,20 +52,6 @@ class JsonParserTest extends Specification {
json == '{"value":15.6,"createdAt":"2018-01-01T00:00:00+0000","id":"123"}'
}
- def 'Should parse to Json given an Account object, a date format and fields to exclude' () {
- given:
- Account account = new Account(
- id: '123',
- value: 15.6,
- createdAt: new SimpleDateFormat('MM/dd/yyyy').parse('01/01/2018')
- )
- when:
- def json = jsonParser.toJson(account, 'MM/dd/yyyy', 'value')
- then:
- json
- json == '{"createdAt":"01/01/2018","id":"123"}'
- }
-
def 'Should prettify given a json string' () {
given:
String json = '{"value":15.6,"createdAt":"01/01/2018","id":"123456"}'