Skip to content

fix: resolve timezone skew and Windows path URL formatting in unit tests#138

Open
tushar2682 wants to merge 1 commit into
braintree:masterfrom
tushar2682:feature/fix-test-failures
Open

fix: resolve timezone skew and Windows path URL formatting in unit tests#138
tushar2682 wants to merge 1 commit into
braintree:masterfrom
tushar2682:feature/fix-test-failures

Conversation

@tushar2682

Copy link
Copy Markdown

I ran the unit tests locally and ran into a couple of environment-related failures.

First, a couple of test cases were failing because Calendar.getInstance() is timezone-dependent. Since my machine is set to a local timezone, the formatted output was off by a few hours compared to the hardcoded UTC timestamps in the assertions. I fixed this by specifying the UTC timezone when initializing the calendars in ThreeDSecureLookupRequestTest and TransactionIndustryRequestTest.

Second, TransactionLevelFeeReportTest was throwing an UnknownHostException on Windows. The test was manually prepending "file://" to the absolute path, which results in "file://C:..." on Windows. Java parses the "C:" as a hostname and fails. I changed it to use .toURI().toURL().toString() which handles the file URL construction cleanly across platforms.

Everything passes successfully now when running mvn test -DskipITs.

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

Successfully merging this pull request may close these issues.

1 participant