diff --git a/pom.xml b/pom.xml index bef445a6..3d8c13c0 100644 --- a/pom.xml +++ b/pom.xml @@ -7,11 +7,10 @@ 2.0.5 - io.spring.platform - platform-bom - Brussels-SR6 - - + org.springframework.boot + spring-boot-starter-parent + 2.1.2.RELEASE + RAML to Spring MVC code generator Component is Maven plugin that reads RAML documents and creates Spring MVC endpoints @@ -56,16 +55,6 @@ - - commons-io - commons-io - - - - commons-collections - commons-collections - - org.raml raml-parser-2 @@ -118,7 +107,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.6.0 provided @@ -140,10 +129,11 @@ junit junit test - + org.hamcrest - hamcrest-all + hamcrest + 2.1 test diff --git a/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/interpreters/PojoBuilder.java b/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/interpreters/PojoBuilder.java index 00daab27..2b773f78 100644 --- a/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/interpreters/PojoBuilder.java +++ b/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/interpreters/PojoBuilder.java @@ -21,9 +21,9 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; -import org.apache.commons.collections.MapUtils; import org.raml.v2.api.model.v10.datamodel.DateTimeTypeDeclaration; import org.raml.v2.api.model.v10.datamodel.TypeDeclaration; import org.slf4j.Logger; @@ -324,7 +324,8 @@ public PojoBuilder withCompleteConstructor() { // because default constructor (without fields) is already present Map nonTransientAndNonStaticFields = getNonTransientAndNonStaticFields(); - if (MapUtils.isNotEmpty(nonTransientAndNonStaticFields)) { + // if nonTransientAndNonStaticFields is not empty + if (!Optional.ofNullable(nonTransientAndNonStaticFields).map(Map::isEmpty).orElse(true)) { // Create complete constructor JMethod constructor = this.pojo.constructor(JMod.PUBLIC); Map superParametersToAdd = getSuperParametersToAdd(this.pojo); diff --git a/src/test/java/com/phoenixnap/oss/ramlplugin/raml2code/rules/AbstractRuleTestBase.java b/src/test/java/com/phoenixnap/oss/ramlplugin/raml2code/rules/AbstractRuleTestBase.java index 34a838e5..ae97d79a 100644 --- a/src/test/java/com/phoenixnap/oss/ramlplugin/raml2code/rules/AbstractRuleTestBase.java +++ b/src/test/java/com/phoenixnap/oss/ramlplugin/raml2code/rules/AbstractRuleTestBase.java @@ -20,7 +20,7 @@ import java.util.Set; import org.hamcrest.MatcherAssert; -import org.hamcrest.text.IsEqualIgnoringWhiteSpace; +import org.hamcrest.text.IsEqualCompressingWhiteSpace; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -146,19 +146,20 @@ protected URI getUri(String resourcePath) throws URISyntaxException { return resource.toURI(); } - public static class IsEqualIgnoringLeadingAndEndingWhiteSpaces extends IsEqualIgnoringWhiteSpace { + public static class IsEqualIgnoringLeadingAndEndingWhiteSpaces extends IsEqualCompressingWhiteSpace { public IsEqualIgnoringLeadingAndEndingWhiteSpaces(String string) { super(string); } - public String stripSpace(String toBeStripped) { + @Override + public String stripSpaces(String toBeStripped) { String result = ""; BufferedReader bufReader = new BufferedReader(new StringReader(toBeStripped)); String line; try { while ((line = bufReader.readLine()) != null) { - result += super.stripSpace(line); + result += super.stripSpaces(line); } } catch (IOException e) { return e.getMessage(); diff --git a/src/test/resources/validations/github/Issue61BaseClient.java.txt b/src/test/resources/validations/github/Issue61BaseClient.java.txt index 6de959e4..e5df1326 100644 --- a/src/test/resources/validations/github/Issue61BaseClient.java.txt +++ b/src/test/resources/validations/github/Issue61BaseClient.java.txt @@ -16,7 +16,7 @@ public class SampleUnit implements Serializable * The type string. * */ - @JsonProperty("t_String") + @JsonProperty("t_string") protected String tString; /**