Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some tests generate failures due to trailing space #333

Open
pmerry96 opened this issue Jul 29, 2024 · 1 comment
Open

Some tests generate failures due to trailing space #333

pmerry96 opened this issue Jul 29, 2024 · 1 comment

Comments

@pmerry96
Copy link

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

@pmerry96
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant