Add Cloud Device API integration tests#1914
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds handling for unencrypted error responses in the EncryptedCloudDeviceApi and introduces a comprehensive integration testing suite. Feedback points out potential NullPointerException risks in the new logic, a missing mock file for async tests, and a thread-safety issue in the test property loader. Suggestions were also made to refactor duplicated test logic and replace console logging with a standard framework.
| cloudDeviceApi.sync(getMerchantAccount(), getTerminalDeviceId(), cloudDeviceApiRequest); | ||
|
|
||
| Assertions.assertNotNull(response); | ||
| System.out.println("Response: " + response); |
There was a problem hiding this comment.
Hey @gcatanese, is there something that you check on the response output? Couldn't that be changed to assertions?
| */ | ||
| public class CloudDeviceApiTerminalIT extends BaseIntegrationTest { | ||
|
|
||
| @Disabled("Enable when you want to test with the Terminal") |
There was a problem hiding this comment.
Perhaps we could use conditional testing? https://docs.junit.org/5.5.0/user-guide/#writing-tests-conditional-execution
There was a problem hiding this comment.
This is "special" integration test class, where tests need to be executed one by one (each test will wait for a response from the Terminal). It might be confusing, but it is the only way to test the integration with the POS terminal works.
There was a problem hiding this comment.
Sure, let's keep like this. If we have some idea in the future, we can address in a follow-up PR. I don't see it a blocker, so I'm leaving the approval.
3f315ea to
ca3faf8
Compare
Adds end-to-end integration tests for the Cloud Device API (sync, async, encrypted variants):
CloudDeviceApiTerminalITfor sending requests to a terminale2e-testing.mddocumenting how to configure and run the terminal testsEncryptedCloudDeviceApi.async()to handle unencrypted error responses (e.g. terminal unreachable) the same waysync()does