Skip to content

Commit 17c4dd4

Browse files
committed
Review checkstyle rules of spring-ws-test
See gh-1479
1 parent 19ae007 commit 17c4dd4

26 files changed

+80
-97
lines changed

spring-ws-test/src/main/java/org/springframework/ws/test/client/RequestXPathExpectations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public interface RequestXPathExpectations {
4848
* @param expectedValue the expected value
4949
* @return the request matcher
5050
*/
51-
RequestMatcher evaluatesTo(final boolean expectedValue);
51+
RequestMatcher evaluatesTo(boolean expectedValue);
5252

5353
/**
5454
* Expects the XPath expression to evaluate to the given integer.

spring-ws-test/src/main/java/org/springframework/ws/test/client/SoapFaultResponseCreator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
import org.springframework.ws.WebServiceMessage;
2323
import org.springframework.ws.soap.SoapBody;
2424
import org.springframework.ws.soap.SoapMessage;
25-
26-
import static org.springframework.ws.test.support.AssertionErrors.fail;
25+
import org.springframework.ws.test.support.AssertionErrors;
2726

2827
/**
2928
* Implementation of {@link ResponseCreator} that responds with a SOAP fault.
@@ -36,12 +35,12 @@ abstract class SoapFaultResponseCreator extends AbstractResponseCreator {
3635
@Override
3736
protected void doWithResponse(URI uri, WebServiceMessage request, WebServiceMessage response) throws IOException {
3837
if (!(response instanceof SoapMessage soapResponse)) {
39-
fail("Response is not a SOAP message");
38+
AssertionErrors.fail("Response is not a SOAP message");
4039
return;
4140
}
4241
SoapBody responseBody = soapResponse.getSoapBody();
4342
if (responseBody == null) {
44-
fail("SOAP message [" + response + "] does not contain SOAP body");
43+
AssertionErrors.fail("SOAP message [" + response + "] does not contain SOAP body");
4544
}
4645
addSoapFault(responseBody);
4746
}

spring-ws-test/src/main/java/org/springframework/ws/test/client/UriMatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import java.net.URI;
2020

2121
import org.springframework.ws.WebServiceMessage;
22-
23-
import static org.springframework.ws.test.support.AssertionErrors.assertEquals;
22+
import org.springframework.ws.test.support.AssertionErrors;
2423

2524
/**
2625
* Matches {@link URI}s.
@@ -38,7 +37,8 @@ class UriMatcher implements RequestMatcher {
3837

3938
@Override
4039
public void match(URI actual, WebServiceMessage request) {
41-
assertEquals("Unexpected connection", this.expected, actual, "Payload", request.getPayloadSource());
40+
AssertionErrors.assertEquals("Unexpected connection", this.expected, actual, "Payload",
41+
request.getPayloadSource());
4242
}
4343

4444
}

spring-ws-test/src/main/java/org/springframework/ws/test/client/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2022 the original author or authors.
2+
* Copyright 2005-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,

spring-ws-test/src/main/java/org/springframework/ws/test/server/MockWebServiceClient.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
import org.springframework.ws.context.MessageContext;
3030
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
3131
import org.springframework.ws.soap.server.SoapMessageDispatcher;
32+
import org.springframework.ws.test.support.AssertionErrors;
3233
import org.springframework.ws.test.support.MockStrategiesHelper;
3334
import org.springframework.ws.transport.WebServiceMessageReceiver;
3435

35-
import static org.springframework.ws.test.support.AssertionErrors.fail;
36-
3736
/**
3837
* <strong>Main entry point for server-side Web service testing</strong>. Typically used
3938
* to test a {@link org.springframework.ws.server.MessageDispatcher MessageDispatcher}
@@ -105,7 +104,7 @@
105104
* @author Lukas Krecan
106105
* @since 2.0
107106
*/
108-
public class MockWebServiceClient {
107+
public final class MockWebServiceClient {
109108

110109
private static final Log logger = LogFactory.getLog(MockWebServiceClient.class);
111110

@@ -186,7 +185,7 @@ public ResponseActions sendRequest(RequestCreator requestCreator) {
186185
}
187186
catch (Exception ex) {
188187
logger.error("Could not send request", ex);
189-
fail(ex.getMessage());
188+
AssertionErrors.fail(ex.getMessage());
190189
return null;
191190
}
192191
}
@@ -207,7 +206,7 @@ public ResponseActions andExpect(ResponseMatcher responseMatcher) {
207206
WebServiceMessage request = this.messageContext.getRequest();
208207
WebServiceMessage response = this.messageContext.getResponse();
209208
if (response == null) {
210-
fail("No response received");
209+
AssertionErrors.fail("No response received");
211210
return null;
212211
}
213212
try {
@@ -216,7 +215,7 @@ public ResponseActions andExpect(ResponseMatcher responseMatcher) {
216215
}
217216
catch (IOException ex) {
218217
logger.error("Could not match request", ex);
219-
fail(ex.getMessage());
218+
AssertionErrors.fail(ex.getMessage());
220219
return null;
221220
}
222221
}

spring-ws-test/src/main/java/org/springframework/ws/test/server/ResponseMatchers.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
import org.springframework.ws.FaultAwareWebServiceMessage;
2929
import org.springframework.ws.WebServiceMessage;
3030
import org.springframework.ws.soap.SoapVersion;
31+
import org.springframework.ws.test.support.AssertionErrors;
3132
import org.springframework.ws.test.support.matcher.SchemaValidatingMatcher;
3233
import org.springframework.ws.test.support.matcher.SoapHeaderMatcher;
3334
import org.springframework.ws.test.support.matcher.xmlunit2.PayloadDiffMatcher;
3435
import org.springframework.ws.test.support.matcher.xmlunit2.SoapEnvelopeDiffMatcher;
3536
import org.springframework.xml.transform.ResourceSource;
3637

37-
import static org.springframework.ws.test.support.AssertionErrors.fail;
38-
3938
/**
4039
* Factory methods for {@link ResponseMatcher} classes. Typically used to provide input
4140
* for {@link ResponseActions#andExpect(ResponseMatcher)}.
@@ -139,7 +138,7 @@ public void match(WebServiceMessage request, WebServiceMessage response)
139138
throws IOException, AssertionError {
140139
if (response instanceof FaultAwareWebServiceMessage faultMessage) {
141140
if (faultMessage.hasFault()) {
142-
fail("Response has a SOAP Fault: \"" + faultMessage.getFaultReason() + "\"");
141+
AssertionErrors.fail("Response has a SOAP Fault: \"" + faultMessage.getFaultReason() + "\"");
143142
}
144143
}
145144
}

spring-ws-test/src/main/java/org/springframework/ws/test/server/ResponseXPathExpectations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public interface ResponseXPathExpectations {
5050
* @param expectedValue the expected value
5151
* @return the request matcher
5252
*/
53-
ResponseMatcher evaluatesTo(final boolean expectedValue);
53+
ResponseMatcher evaluatesTo(boolean expectedValue);
5454

5555
/**
5656
* Expects the XPath expression to evaluate to the given integer.

spring-ws-test/src/main/java/org/springframework/ws/test/server/SoapFaultResponseMatcher.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
import org.springframework.ws.soap.SoapFault;
2626
import org.springframework.ws.soap.SoapMessage;
2727
import org.springframework.ws.soap.SoapVersion;
28-
29-
import static org.springframework.ws.test.support.AssertionErrors.assertEquals;
30-
import static org.springframework.ws.test.support.AssertionErrors.assertTrue;
28+
import org.springframework.ws.test.support.AssertionErrors;
3129

3230
/**
3331
* Abstract Implementation of {@link ResponseMatcher} that checks for a SOAP fault.
@@ -45,16 +43,16 @@ abstract class SoapFaultResponseMatcher implements ResponseMatcher {
4543

4644
@Override
4745
public void match(WebServiceMessage request, WebServiceMessage response) throws IOException, AssertionError {
48-
assertTrue("Response is not a SOAP message", response instanceof SoapMessage);
46+
AssertionErrors.assertTrue("Response is not a SOAP message", response instanceof SoapMessage);
4947
SoapMessage soapResponse = (SoapMessage) response;
5048
SoapBody responseBody = soapResponse.getSoapBody();
51-
assertTrue("Response has no SOAP Body", responseBody != null);
52-
assertTrue("Response has no SOAP Fault", responseBody.hasFault());
49+
AssertionErrors.assertTrue("Response has no SOAP Body", responseBody != null);
50+
AssertionErrors.assertTrue("Response has no SOAP Fault", responseBody.hasFault());
5351
SoapFault soapFault = responseBody.getFault();
5452
QName expectedFaultCode = getExpectedFaultCode(soapResponse.getVersion());
55-
assertEquals("Invalid SOAP Fault code", expectedFaultCode, soapFault.getFaultCode());
53+
AssertionErrors.assertEquals("Invalid SOAP Fault code", expectedFaultCode, soapFault.getFaultCode());
5654
if (this.expectedFaultStringOrReason != null) {
57-
assertEquals("Invalid SOAP Fault string/reason", this.expectedFaultStringOrReason,
55+
AssertionErrors.assertEquals("Invalid SOAP Fault string/reason", this.expectedFaultStringOrReason,
5856
soapFault.getFaultStringOrReason());
5957
}
6058
}

spring-ws-test/src/main/java/org/springframework/ws/test/server/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2022 the original author or authors.
2+
* Copyright 2005-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,

spring-ws-test/src/main/java/org/springframework/ws/test/support/SourceAssertionError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public String getMessage() {
6868
if (sourceString != null) {
6969
String newLine = System.lineSeparator();
7070
builder.append(newLine);
71-
String label = this.sourceLabel != null ? this.sourceLabel : "Source";
71+
String label = (this.sourceLabel != null) ? this.sourceLabel : "Source";
7272
builder.append(label);
7373
builder.append(": ");
7474
builder.append(sourceString);

0 commit comments

Comments
 (0)