Repository navigation
Follow the shared poll-delay rules and test them offline - #32
Merged
Merged
Conversation
Search and preview polling now read x-ms-delay through one package-private pollDelay function. An entry that is empty, negative or not a number counts as 1000 ms instead of throwing NumberFormatException. Package-private hooks let tests swap the HTTP transport, sleep and clock without changing the public API. PollingTest covers the shared spec's 14 cases with MockHttpTransport and a fake clock, so it runs without secrets: mvn test -Dtest=PollingTest
A delay entry now counts only when it is one or more ASCII digits after trimming. Signs, decimals, hex, units, non-ASCII digits and values too big for an int count as 1000 ms, as before for other non-numbers. PollingTest moves to the shared spec's 18 cases: wider not-a-number coverage, elapsed time measured in milliseconds, and the delay read from the latest response. The stub transport fails a test after 20 requests, so a broken timeout check fails instead of hanging.
The search tests that end in a match now check that the result holds exactly one item, match-id, so an extra item fails the test.
Parsing is shared, so preview keeps only tests of its own loop. The search and preview timeout tests now use delays whose sum just passes the timeout, so they also catch elapsed time counted in whole seconds or checked only after the timeout has passed.
ad-mailosaur
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Messages.searchandFiles.getPreviewparse eachx-ms-delayentry withInteger.parseInt, so an empty or non-numeric entry throwsNumberFormatExceptionout of polling. No test covers poll delays.Changes
x-ms-delaythrough one package-privatepollDelayinMailosaurClient. Poll n uses entry n, the last entry repeats, and each wait is used exactly as given, in milliseconds.int. Anything else (a sign, decimal, hex, units, letters, an empty entry) or no header waits 1000 ms.0means no wait.PollingTestadds the 9 poll-delay tests (5 search, 4 preview) that every Mailosaur client shares. They run offline withMockHttpTransportand a fake clock (mvn test -Dtest=PollingTest), and fail after 20 requests instead of hanging.