Refactor ContractsTests to use Java text blocks#1435
Conversation
|
Warning Rate limit exceeded@cobayo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 19 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughRemoved two external test resource files (CheckContractPositiveCases.java and CheckContractNegativeCases.java) and inlined their contents into the ContractsTests test class via addSourceLines. Also removed the class-level Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @nullaway/src/test/java/com/uber/nullaway/ContractsTests.java:
- Around line 16-79: The virtual filenames passed to addSourceLines should match
the declared package; update the first argument strings for the test sources so
they use package-qualified paths that match package com.uber.nullaway.testdata
(e.g., change "CheckContractPositiveCases.java" to
"com.uber.nullaway.testdata.CheckContractPositiveCases.java" or the test
framework's expected package-qualified form) for the CheckContractPositiveCases
class (and do the same for CheckContractNegativeCases and any other
addSourceLines entries that declare package com.uber.nullaway.testdata) so
diagnostics/searchability align with the declared package.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
nullaway/src/test/java/com/uber/nullaway/ContractsTests.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
Applied to files:
nullaway/src/test/java/com/uber/nullaway/ContractsTests.java
🔇 Additional comments (1)
nullaway/src/test/java/com/uber/nullaway/ContractsTests.java (1)
16-79: LGTM: inlining the former testdata sources reads cleanly and should keep behavior stable.
Good simplification by removing external test files and keeping the// BUG: Diagnostic contains:assertions close to the tests.Also applies to: 119-155
- Migrated test data from external files to inline text blocks using addSourceLines. - Deleted physical test files: CheckContractPositiveCases.java and CheckContractNegativeCases.java. - Removed unnecessary @SuppressWarnings("deprecation") annotations. - Part of the ongoing effort to modernize tests (uber#1425).
af0bb6b to
8ccb264
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1435 +/- ##
=========================================
Coverage 88.44% 88.44%
Complexity 2672 2672
=========================================
Files 97 97
Lines 8852 8852
Branches 1772 1772
=========================================
Hits 7829 7829
Misses 507 507
Partials 516 516 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Following up on my previous PR and the goal of issue uber#1425, I have refactored ContractsTests.java. - Migrated test data from external files to inline text blocks using addSourceLines. - Deleted physical test files: CheckContractPositiveCases.java and CheckContractNegativeCases.java. - Removed unnecessary @SuppressWarnings("deprecation") annotations. - Part of the ongoing effort to modernize tests (uber#1425). Thank you for contributing to NullAway! Please note that once you click "Create Pull Request" you will be asked to sign our [Uber Contributor License Agreement](https://cla-assistant.io/uber/NullAway) via [CLA assistant](https://cla-assistant.io/). Before pressing the "Create Pull Request" button, please provide the following: - [x] A description about what and why you are contributing, even if it's trivial. - [x] The issue number(s) or PR number(s) in the description if you are contributing in response to those. - [x] If applicable, unit tests. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Consolidated external test-data into inline test cases within the test suite for simpler maintenance and clearer test flow. * Removed separate public test-data classes that previously existed as external resources. * Dropped a deprecation-suppression annotation from the public test class to reflect current warnings handling. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Following up on my previous PR and the goal of issue #1425, I have refactored ContractsTests.java.
com.google.errorprone.CompilationTestHelper#addSourceFilein tests #1425).Thank you for contributing to NullAway!
Please note that once you click "Create Pull Request" you will be asked to sign our Uber Contributor License Agreement via CLA assistant.
Before pressing the "Create Pull Request" button, please provide the following:
A description about what and why you are contributing, even if it's trivial.
The issue number(s) or PR number(s) in the description if you are contributing in response to those.
If applicable, unit tests.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.