Some tests generate failures due to trailing space
Opened this issue · 1 comments
The following tests generated failures:
TEST-com.sforce.ws.codegen.SObjectCodeGeneratorTest.xml
TEST-com.sforce.ws.codegen.ConnectorCodeGeneratorTest.xml
TEST-com.sforce.ws.codegen.AggregateCodeGeneratorTest.xml
Version: 61.1.0 - I have the tag checked out
Environment: Windows 10
Java version: openjdk-22 and the corretto-1.8 version of the Java 1.8 JDK.
Issue:
The issue I ran into was that tests would fail when running "mvn clean package" with a similar result to the example I will paste below:
<failure message="expected:<...rce.soap.enterprise;[ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.ConnectionException; /** * This is a generated class for the SObject Enterprise API. * Do not edit this file, as your changes will be lost. */ public class Connector { public static final String END_POINT = "https://login.salesforce.com/services/Soap/c/16.0"; public static EnterpriseConnection newConnection(String username, String password) throws ConnectionException { ConnectorConfig config = new ConnectorConfig(); config.setUsername(username); config.setPassword(password); return newConnection(config); } public static EnterpriseConnection newConnection(ConnectorConfig config) throws ConnectionException { if (config.getAuthEndpoint() == null) { config.setAuthEndpoint(END_POINT); } if (config.getServiceEndpoint() == null) { config.setServiceEndpoint(END_POINT); } return new EnterpriseConnection(config); } } ] > but was:<...rce.soap.enterprise;[ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.ConnectionException; /** * This is a generated class for the SObject Enterprise API. * Do not edit this file, as your changes will be lost. */ public class Connector { public static final String END_POINT = "https://login.salesforce.com/services/Soap/c/16.0"; public static EnterpriseConnection newConnection(String username, String password) throws ConnectionException { ConnectorConfig config = new ConnectorConfig(); config.setUsername(username); config.setPassword(password); return newConnection(config); } public static EnterpriseConnection newConnection(ConnectorConfig config) throws ConnectionException { if (config.getAuthEndpoint() == null) { config.setAuthEndpoint(END_POINT); } if (config.getServiceEndpoint() == null) { config.setServiceEndpoint(END_POINT); } return new EnterpriseConnection(config); } }] >" type="junit.framework.ComparisonFailure">
</failure>
Text was copied directly from output - I will put a formatted version below:
<failure message="expected:
<...rce.soap.enterprise;[ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.ConnectionException; /** * This is a generated class for the SObject Enterprise API. * Do not edit this file, as your changes will be lost. */ public class Connector { public static final String END_POINT = "https://login.salesforce.com/services/Soap/c/16.0"; public static EnterpriseConnection newConnection(String username, String password) throws ConnectionException { ConnectorConfig config = new ConnectorConfig(); config.setUsername(username); config.setPassword(password); return newConnection(config); } public static EnterpriseConnection newConnection(ConnectorConfig config) throws ConnectionException { if (config.getAuthEndpoint() == null) { config.setAuthEndpoint(END_POINT); } if (config.getServiceEndpoint() == null) { config.setServiceEndpoint(END_POINT); } return new EnterpriseConnection(config); } } ] >
but was:
<...rce.soap.enterprise;[ import com.sforce.ws.ConnectorConfig; import com.sforce.ws.ConnectionException; /** * This is a generated class for the SObject Enterprise API. * Do not edit this file, as your changes will be lost. */ public class Connector { public static final String END_POINT = "https://login.salesforce.com/services/Soap/c/16.0"; public static EnterpriseConnection newConnection(String username, String password) throws ConnectionException { ConnectorConfig config = new ConnectorConfig(); config.setUsername(username); config.setPassword(password); return newConnection(config); } public static EnterpriseConnection newConnection(ConnectorConfig config) throws ConnectionException { if (config.getAuthEndpoint() == null) { config.setAuthEndpoint(END_POINT); } if (config.getServiceEndpoint() == null) { config.setServiceEndpoint(END_POINT); } return new EnterpriseConnection(config); } }] >" type="junit.framework.ComparisonFailure">
</failure>
Youll notice the expected/observed output is the same except for the very end in the bracketing. It appears to be related to a missing space following the closing } of the generated code.
Expected: ...} } ] >
Recieved: ...} }] >
This generates what is essentially an ignorable test failure, but should be resolved so the provided instructions to perform a "mvn clean package" generate a successful result with no errors.
I may be able to make a PR relating to this, but no promises on the time frame I can get to it
My current workaround for this was to add the following line to my pom.xml file in the following section
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<forkMode>always</forkMode>
<useManifestOnlyJar>false</useManifestOnlyJar>
<testFailureIgnore>true</testFailureIgnore>
the <testFailureIgnore>true</testFailureIgnore>
line is what I added.
Anyone reading this issue, I suggest first running without this line in place and, should any test failures occur, view the output test result xml files to verify that the only failures are of the nature I described above in my opening comments