Skip to content

test: add unit tests for TransportResult#2

Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774289034-transport-result-tests
Draft

test: add unit tests for TransportResult#2
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774289034-transport-result-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

📜 Description

Adds a new test file TransportResultTest.kt with 8 unit tests for TransportResult, which previously had zero test coverage.

Tests cover both factory methods and the two internal result types:

  • success()isSuccess flag, responseCode value, singleton identity
  • error(code) / error()isSuccess flag, response code forwarding, default -1 code, new-instance-per-call behavior

💡 Motivation and Context

TransportResult is used throughout the transport layer to signal whether an envelope was sent successfully. Despite being a foundational piece of the send pipeline, it had no dedicated unit tests. This PR closes that gap with a small, low-risk, test-only change.

💚 How did you test it?

./gradlew :sentry:test --tests "*TransportResultTest*"
# All 8 tests PASSED

./gradlew :sentry:spotlessApply
# Formatting clean, no changes needed

Reviewer checklist

  • Verify the assertSame singleton test (line 20–22) matches intentional design of SuccessTransportResult.INSTANCE — this locks in the singleton contract.
  • Consider whether edge-case HTTP codes (0, negative values) are worth adding tests for error().

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Other classes in the transport package with zero test coverage that could benefit from the same treatment:

  • CurrentDateProvider, ProxyAuthenticator, AuthenticatorWrapper

Link to Devin session: https://app.devin.ai/sessions/23aaff7eb99e45c79503152f36003ab8
Requested by: @aks4396

@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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