Skip to content

Commit

Permalink
Merge pull request #1016 from markstrecker
Browse files Browse the repository at this point in the history
* pr/1016:
  Polish "Fix Groovy array declaration"
  Fix Groovy array declaration

Closes gh-1016
  • Loading branch information
snicoll committed Oct 21, 2019
2 parents 20b03fc + cddd4c7 commit 99b0a4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private String formatAnnotationAttribute(Annotation.Attribute attribute) {

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void annotationWithClassArrayAttribute() throws IOException {
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 {", "", "}");
}

Expand Down

0 comments on commit 99b0a4b

Please sign in to comment.