Merge pull request #1016 from markstrecker

* pr/1016:
  Polish "Fix Groovy array declaration"
  Fix Groovy array declaration

Closes gh-1016
This commit is contained in:
Stephane Nicoll 2019-10-21 14:09:43 +02:00
commit 99b0a4b620
2 changed files with 2 additions and 2 deletions

View File

@ -179,7 +179,7 @@ public class GroovySourceCodeWriter implements SourceCodeWriter<GroovySourceCode
private String formatValues(List<String> values, Function<String, String> formatter) {
String result = values.stream().map(formatter).collect(Collectors.joining(", "));
return (values.size() > 1) ? "{ " + result + " }" : result;
return (values.size() > 1) ? "[ " + result + " ]" : result;
}
private void writeFieldDeclaration(IndentingWriter writer, GroovyFieldDeclaration fieldDeclaration) {

View File

@ -243,7 +243,7 @@ class GroovySourceCodeWriterTests {
List<String> lines = writeClassAnnotation(Annotation.name("org.springframework.test.TestApplication",
(builder) -> builder.attribute("target", Class.class, "com.example.One", "com.example.Two")));
assertThat(lines).containsExactly("package com.example", "", "import com.example.One", "import com.example.Two",
"import org.springframework.test.TestApplication", "", "@TestApplication(target = { One, Two })",
"import org.springframework.test.TestApplication", "", "@TestApplication(target = [ One, Two ])",
"class Test {", "", "}");
}