Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,7 +94,6 @@ public class DefaultXmlPayloadConverterTests {
assertThat(n).and(TEST_DOCUMENT_AS_STRING).areIdentical();
}
@Test
public void testGetSourcePassingDocument() {
Source source = converter.convertToSource(testDocument);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@ import org.springframework.integration.xml.transformer.XPathTransformer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Gunnar Hillert
* @author Artem Bilan

View File

@@ -16,7 +16,6 @@
package org.springframework.integration.xml.config;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,7 +47,6 @@ public class DefaultConfigurationTests {
@Autowired
private ApplicationContext context;
@Test
public void verifyErrorChannel() {
Object errorChannel = context.getBean("errorChannel");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,6 @@ public class TestXmlApplicationContext extends AbstractXmlApplicationContext {
this.xmlString = xmlString;
}
@Override
public String getDescription() {
return "test";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -134,7 +134,6 @@ public class UnmarshallingTransformerParserTests {
assertThat(unmarshaller.sourcesPassed.poll()).isInstanceOf(StringSource.class);
}
@Test
public void testUnmarshallUnsupported() {
MessageChannel input = (MessageChannel) appContext.getBean("input");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,6 @@ public class XPathHeaderEnricherParserTests {
private final Message<?> message =
MessageBuilder.withPayload("<person name='John Doe' age='42' married='true'/>").build();
@Test
public void testParse() {
EventDrivenConsumer consumer = (EventDrivenConsumer) context.getBean("parseOnly");
@@ -171,7 +170,6 @@ public class XPathHeaderEnricherParserTests {
assertThat(reply.getHeaders().get("foo")).isEqualTo("bar");
}
private Message<?> getResultMessage() {
this.input.send(message);
return output.receive(0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,6 @@ public class XPathRouterParserTests {
@Autowired @Qualifier("defaultOutput")
QueueChannel defaultOutput;
ConfigurableApplicationContext appContext;
public EventDrivenConsumer buildContext(String routerDef) {
@@ -90,7 +89,6 @@ public class XPathRouterParserTests {
return consumer;
}
@AfterEach
public void tearDown() {
if (appContext != null) {
@@ -333,7 +331,6 @@ public class XPathRouterParserTests {
ac.close();
}
@SuppressWarnings("unused")
private static class TestXmlPayloadConverter extends DefaultXmlPayloadConverter {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -159,7 +159,6 @@ public class XPathTransformerParserTests {
assertThat(output.receive(0).getPayload()).isEqualTo(84d);
}
@SuppressWarnings("unused")
private static class TestNodeMapper implements NodeMapper<Object> {
@@ -167,8 +166,8 @@ public class XPathTransformerParserTests {
public Object mapNode(Node node, int nodeNum) throws DOMException {
return node.getTextContent() + "-mapped";
}
}
}
@SuppressWarnings("unused")
private static class TestXmlPayloadConverter implements XmlPayloadConverter {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,6 @@ public class StringSourceTests {
assertThat(docAsString).and(testDoc).areIdentical();
}
@Test
public void testWithString() throws Exception {
String docString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><item>one</item>";
@@ -64,7 +63,6 @@ public class StringSourceTests {
assertThat(docAsString).and(docString).areIdentical();
}
@Test
public void testWithUnsupportedPayload() {
StringBuffer buffer = new StringBuffer(testDoc);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ public class XPathMessageSplitterTests {
private final QueueChannel replyChannel = new QueueChannel();
@BeforeEach
public void setUp() {
String splittingXPath = "/orders/order";
@@ -53,7 +52,6 @@ public class XPathMessageSplitterTests {
this.splitter.setRequiresReply(true);
}
@Test
public void splitDocument() throws Exception {
Document doc = XmlTestUtil.getDocumentForString("""

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.integration.xml.transformer;
import java.io.StringWriter;
import javax.xml.transform.Result;
@@ -28,7 +27,6 @@ public class CustomTestResultFactory implements ResultFactory {
private final String stringToReturn;
public CustomTestResultFactory(String stringToReturn) {
this.stringToReturn = stringToReturn;
}
@@ -39,7 +37,6 @@ public class CustomTestResultFactory implements ResultFactory {
public static class FixedStringResult extends StreamResult {
private final String stringToReturn;
public FixedStringResult(String stringToReturn) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,6 @@ public class MarshallingTransformerTests {
assertThat(marshaller.messages.get(0)).isSameAs(message);
}
private static class TestMarshaller implements Marshaller {
private final List<Message<?>> messages = new ArrayList<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,6 @@ public class ResultToStringTransformerTests {
</order>
""";
@BeforeEach
public void setUp() {
transformer = new ResultToStringTransformer();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,6 @@ public class UnmarshallingTransformerTests {
assertThat(result.getPayload()).isEqualTo("message: bar");
}
private record TestUnmarshaller(boolean returnMessage) implements Unmarshaller {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,13 +51,11 @@ public class XPathTransformerTests {
private volatile Message<?> message;
@BeforeEach
public void createMessage() {
this.message = MessageBuilder.withPayload(XML).build();
}
@Test
public void stringResultTypeByDefault() {
XPathTransformer transformer = new XPathTransformer("/parent/child/@name");
@@ -137,7 +135,6 @@ public class XPathTransformerTests {
assertThat(result).isEqualTo("custom");
}
private static class TestNodeMapper implements NodeMapper<Object> {
TestNodeMapper() {
@@ -151,7 +148,6 @@ public class XPathTransformerTests {
}
private static class TestXmlPayloadConverter implements XmlPayloadConverter {
TestXmlPayloadConverter() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.xmlunit.assertj3.XmlAssert.assertThat;
/**
* @author Jonas Partner
* @author Oleg Zhurakousky
@@ -199,7 +198,6 @@ public class XsltPayloadTransformerTests {
assertThat(transformed).and(this.outputAsString).areIdentical();
}
@Test
public void documentInStringResultOut() throws Exception {
Resource resource = new ClassPathResource("transform-with-import.xsl", getClass());
@@ -215,7 +213,6 @@ public class XsltPayloadTransformerTests {
.isInstanceOf(StringResult.class);
}
@Test
public void stringInDomResultOut() throws Exception {
Resource resource = new ClassPathResource("transform-with-import.xsl", getClass());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +122,6 @@ public class XsltTransformerTests {
assertThat(((String) resultMessage.getPayload()).contains("hello")).isTrue();
}
@Test
public void outputAsString() {
var input = applicationContext.getBean("outputAsStringChannel", MessageChannel.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,6 @@ public class JaxbMarshallingIntegrationTests {
assertThat(doc.getDocumentElement().getLocalName()).as("Wrong name for root element ").isEqualTo("person");
}
@Test
public void testUnmarshalling() {
StringSource source = new StringSource("<person><firstname>bob</firstname></person>");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,4 +86,5 @@ public class XmlTestUtil {
transform(source, res);
return res.toString();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,7 +129,6 @@ public class XPathTests {
result = XPathUtils.evaluate(XML, "/parent/child/@name", new TestNodeMapper());
assertThat(result).isEqualTo("test-mapped");
assertThatExceptionOfType(MessagingException.class)
.isThrownBy(() -> XPathUtils.evaluate(new Date(), "/parent/child"))
.withMessageContaining("unsupported payload type");
@@ -185,7 +184,6 @@ public class XPathTests {
assertThat(stringSourceFactory.createSource(receive.getPayload()).toString()).contains("<book>book2</book>");
}
@Test
public void testInt3140Router() {
this.xpathRouterInput.send(new GenericMessage<Object>("<name>A</name>"));
@@ -205,7 +203,6 @@ public class XPathTests {
assertThat(receive.getPayload()).isEqualTo("<name>X</name>");
}
public static class TestNodeMapper implements NodeMapper<String> {
@Override