Skip to content

Commit c3e66f3

Browse files
committed
[MPH-219] Automatic spotless apply after rebase with master
1 parent ba221a8 commit c3e66f3

File tree

1 file changed

+50
-31
lines changed

1 file changed

+50
-31
lines changed
Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,68 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.maven.plugins.help;
220

21+
import java.io.StringWriter;
22+
import java.nio.charset.Charset;
23+
import java.util.Properties;
24+
325
import org.codehaus.plexus.util.StringUtils;
426
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
527
import org.codehaus.plexus.util.xml.XMLWriter;
628
import org.codehaus.plexus.util.xml.XmlWriterUtil;
729
import org.junit.jupiter.api.Test;
830

9-
import java.io.StringWriter;
10-
import java.nio.charset.Charset;
11-
import java.util.Properties;
12-
1331
import static org.junit.jupiter.api.Assertions.assertEquals;
1432

1533
class EffectiveMojoUtilsTest {
1634

1735
private final StringWriter w = new StringWriter();
1836
private final String encoding = Charset.defaultCharset().displayName();
19-
private final XMLWriter writer = new PrettyPrintXMLWriter(w, StringUtils.repeat(" ", XmlWriterUtil.DEFAULT_INDENTATION_SIZE), encoding, null);
20-
37+
private final XMLWriter writer = new PrettyPrintXMLWriter(
38+
w, StringUtils.repeat(" ", XmlWriterUtil.DEFAULT_INDENTATION_SIZE), encoding, null);
2139

2240
@Test
2341
void writeHeaderShouldWriteHeaderComments() {
2442
EffectiveMojoUtils.writeHeader(writer);
2543

26-
assertEquals(String.format("<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding) +
27-
"<!-- ====================================================================== -->\n" +
28-
"<!-- -->\n" +
29-
"<!-- Generated by Maven Help Plugin -->\n" +
30-
"<!-- See: https://maven.apache.org/plugins/maven-help-plugin/ -->\n" +
31-
"<!-- -->\n" +
32-
"<!-- ====================================================================== -->\n",
44+
assertEquals(
45+
String.format("<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding)
46+
+ "<!-- ====================================================================== -->\n"
47+
+ "<!-- -->\n"
48+
+ "<!-- Generated by Maven Help Plugin -->\n"
49+
+ "<!-- See: https://maven.apache.org/plugins/maven-help-plugin/ -->\n"
50+
+ "<!-- -->\n"
51+
+ "<!-- ====================================================================== -->\n",
3352
w.toString());
3453
}
3554

3655
@Test
3756
void writeCommentShouldWriteGivenComment() {
3857
EffectiveMojoUtils.writeComment(writer, "This is a comment");
3958

40-
assertEquals(String.format("<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding) +
41-
"<!-- ====================================================================== -->\n" +
42-
"<!-- -->\n" +
43-
"<!-- This is a comment -->\n" +
44-
"<!-- -->\n" +
45-
"<!-- ====================================================================== -->\n",
59+
assertEquals(
60+
String.format("<?xml version=\"1.0\" encoding=\"%s\"?>\n", encoding)
61+
+ "<!-- ====================================================================== -->\n"
62+
+ "<!-- -->\n"
63+
+ "<!-- This is a comment -->\n"
64+
+ "<!-- -->\n"
65+
+ "<!-- ====================================================================== -->\n",
4666
w.toString());
4767
}
4868

@@ -72,12 +92,13 @@ void prettyFormatShouldFormatXmlString() {
7292

7393
final String prettyXml = EffectiveMojoUtils.prettyFormat(xml, encoding, false);
7494

75-
assertEquals("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n" +
76-
"<root>\n" +
77-
" <child>\n" +
78-
" <subchild>value</subchild>\n" +
79-
" </child>\n" +
80-
"</root>\n", prettyXml);
95+
assertEquals(
96+
"<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n" + "<root>\n"
97+
+ " <child>\n"
98+
+ " <subchild>value</subchild>\n"
99+
+ " </child>\n"
100+
+ "</root>\n",
101+
prettyXml);
81102
}
82103

83104
@Test
@@ -86,10 +107,8 @@ void prettyFormatShouldOmitDeclarationWhenSpecified() {
86107

87108
final String prettyXml = EffectiveMojoUtils.prettyFormat(xml, encoding, true);
88109

89-
assertEquals("<root>\n" +
90-
" <child>\n" +
91-
" <subchild>value</subchild>\n" +
92-
" </child>\n" +
93-
"</root>\n", prettyXml);
110+
assertEquals(
111+
"<root>\n" + " <child>\n" + " <subchild>value</subchild>\n" + " </child>\n" + "</root>\n",
112+
prettyXml);
94113
}
95-
}
114+
}

0 commit comments

Comments
 (0)