Skip to content

Fix tests by setting UTC timezone for CommCare date formatting to ensure consistent timestamp parsing - #1781

Open
meladRaouf wants to merge 1 commit into
mainfrom
fix-commcare-tests
Open

Fix tests by setting UTC timezone for CommCare date formatting to ensure consistent timestamp parsing#1781
meladRaouf wants to merge 1 commit into
mainfrom
fix-commcare-tests

Conversation

@meladRaouf

Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud

Copy link
Copy Markdown

// the machine's default timezone (e.g. "Europe/London" prints "GMT" for its short zone name even
// during BST, which reparsed as literal GMT/UTC+0 would silently shift timestamps by an hour).
private val commCareDateFormat = SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US).apply {
timeZone = TimeZone.getTimeZone("UTC")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this not needed before?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be fine in my local runs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the issue I am getting

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification failed: call 1 of 1: ContentResolver(mockContentResolver#15).query(eq(Uri(#3)), any(), any(), any(), any())) should not be called

Calls:

  1. ContentResolver(mockContentResolver#15).query(Uri(#1), null, null, null, null)
  2. ContentResolver(mockContentResolver#15).query(Uri(#1), [case_id, last_modified], null, null, null)
  3. ContentResolver(mockContentResolver#15).query(Uri(#3), null, null, null, null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻

Screenshot 2026-08-12 at 15 24 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants