Skip to content

chore(time skip): added examples for testing and time skipping in Java#4801

Open
flippedcoder wants to merge 3 commits into
mainfrom
mm/java-time-skip
Open

chore(time skip): added examples for testing and time skipping in Java#4801
flippedcoder wants to merge 3 commits into
mainfrom
mm/java-time-skip

Conversation

@flippedcoder

@flippedcoder flippedcoder commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This updates the testing best practices page for Java to have more of the content as the other SDK testing pages.

Notes to reviewers

┆Attachments: EDU-6629 chore(time skip): added examples for testing and time skipping in Java

@flippedcoder flippedcoder self-assigned this Jul 1, 2026
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment Jul 2, 2026 4:05pm

Request Review

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

  • Develop

@flippedcoder flippedcoder marked this pull request as ready for review July 2, 2026 16:03
@flippedcoder flippedcoder requested a review from a team as a code owner July 2, 2026 16:03
- Time doesn't skip while Activities and Nexus operations are executing.

Start a test server process that skips time as needed.
For example, in the time-skipping mode, Timers, which include sleeps and conditional timeouts, are fast-forwarded except when Activities or Nexus Operation handlers are running. Nexus Operation handlers timeout after 10 seconds and time skipping is allowed while waiting for retries.

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.

I think we should keep this Nexus line!

testEnv.sleep(Duration.ofHours(25));
assertEquals(2, workflow.daysElapsed());
}
}

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.

I'll give this a full review sometime today!

When you execute a Workflow and wait for the result, the test environment automatically skips Workflow timers such as `Workflow.sleep`. This means:

#### Skip time automatically {/* #automatic-method */}
- Workflow timers (like `Workflow.Sleep`) are fast-forwarded.

@jsundai jsundai Jul 2, 2026

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.

small typo! - Workflow.sleep

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.

2 participants