From 52d257a5458a5b36c4ee984c3c64fc80b3af1bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Mattos=20Torr=C3=A3o?= Date: Wed, 7 Mar 2018 09:13:24 -0300 Subject: [PATCH] fix: groovy dependency version (#3776) --- core-groovy/build.gradle | 2 +- core-groovy/pom.xml | 6 +++--- .../groovy/com/baeldung/json/JsonParser.groovy | 9 --------- .../groovy/com/baeldung/json/JsonParserTest.groovy | 14 -------------- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/core-groovy/build.gradle b/core-groovy/build.gradle index b3f33836daf4..300827ee7caf 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 961a4ba12577..91cbe66e35f3 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 0d7c451972e8..6cda7c6fbdf7 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 fcd51d58bcf8..c3842340a588 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"}'