refactor(#4862): remove unnecessary FpDefault references from tests#4872
Conversation
📝 WalkthroughWalkthroughThis change removes FpDefault and three related footprint classes plus a test file, deleting their implementations and many test helpers; no public API declarations were altered. Remaining tests and other code are left intact. (50 words) Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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 |
🚀 Performance AnalysisAll benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information. Click to see the detailed report
✅ Performance gain: |
There was a problem hiding this comment.
Pull request overview
This PR updates eo-maven-plugin test code to reduce/remove usages of FpDefault by deleting several FpDefaultTest test cases and related helper utilities.
Changes:
- Removed two
FpDefaultTestcases that exercised caching behavior for1.0-SNAPSHOTand0.0.0. - Removed multiple private helper methods and an inner
Cachehelper class previously used by those tests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -206,66 +103,4 @@ private static void makeOlder(final Path file, final long time) throws IOExcepti | |||
| FileTime.fromMillis(System.currentTimeMillis() + time) | |||
There was a problem hiding this comment.
makeOlder(...) currently sets the last-modified time to System.currentTimeMillis() + time, which makes the file newer (in the future), not older as the method name/Javadoc claim. Either subtract the offset (to truly make it older) or rename/update the Javadoc so the helper’s intent is unambiguous.
| FileTime.fromMillis(System.currentTimeMillis() + time) | |
| FileTime.fromMillis(System.currentTimeMillis() - time) |
| @@ -27,57 +27,6 @@ | |||
| @ExtendWith(MktmpResolver.class) | |||
| final class FpDefaultTest { | |||
There was a problem hiding this comment.
The PR description/linked issue indicates the puzzle is resolved when the TODO in FpDefault.java is removed, but this PR only removes some test usages and still leaves FpDefault referenced (and the source TODO remains). Either update the PR scope/description or include the corresponding production-code change so the referenced puzzle is actually addressed.
| @ExtendWith(MktmpResolver.class) | ||
| final class FpDefaultTest { | ||
|
|
||
| @Test | ||
| void usesCacheEvenItIsSnapshot(@Mktmp final Path temp) throws Exception { | ||
| final Path source = FpDefaultTest.existedSource(temp); | ||
| final Path target = FpDefaultTest.notExistedTarget(temp); | ||
| final String version = "1.0-SNAPSHOT"; | ||
| final String hash = "snapshothash"; | ||
| final Cache cache = FpDefaultTest.notExistedCache(temp, version, hash); | ||
| FpDefaultTest.existedFile(cache.path(), FpDefaultTest.cacheContent()); | ||
| FpDefaultTest.makeOlder(cache.path()); | ||
| new FpDefault( | ||
| src -> FpDefaultTest.footprintContent(), | ||
| temp.resolve("cache"), | ||
| version, | ||
| hash, | ||
| Path.of("") | ||
| ).apply(source, target); | ||
| MatcherAssert.assertThat( | ||
| "We expect that cache is used even for SNAPSHOT version", | ||
| new TextOf(target).asString(), | ||
| Matchers.allOf( | ||
| Matchers.equalTo(FpDefaultTest.cacheContent()), | ||
| Matchers.not(Matchers.equalTo(FpDefaultTest.footprintContent())) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| void cachesEvenItIsZeroVersion(@Mktmp final Path temp) throws Exception { | ||
| final Path source = FpDefaultTest.existedSource(temp); | ||
| final Path target = FpDefaultTest.notExistedTarget(temp); | ||
| final String version = "0.0.0"; | ||
| final String hash = "zerohash"; | ||
| final Cache cache = FpDefaultTest.notExistedCache(temp, version, hash); | ||
| FpDefaultTest.existedFile(cache.path(), FpDefaultTest.cacheContent()); | ||
| FpDefaultTest.makeOlder(cache.path()); | ||
| new FpDefault( | ||
| src -> FpDefaultTest.footprintContent(), | ||
| temp.resolve("cache"), | ||
| version, | ||
| hash, | ||
| Path.of("") | ||
| ).apply(source, target); | ||
| MatcherAssert.assertThat( | ||
| "We expect that cache is used even for 0.0.0 version", | ||
| new TextOf(target).asString(), | ||
| Matchers.allOf( | ||
| Matchers.equalTo(FpDefaultTest.cacheContent()), | ||
| Matchers.not(Matchers.equalTo(FpDefaultTest.footprintContent())) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * We should use the transpilation cache if it existed before transpilation. |
There was a problem hiding this comment.
This change removes the only enabled FpDefault tests from this class; the remaining test in FpDefaultTest is @Disabled, leaving no active coverage for FpDefault behavior. If FpDefault is still expected to work (even as test-only code), consider keeping at least one enabled regression test or deleting the entire class along with FpDefault itself.
| FileTime.fromMillis(System.currentTimeMillis() + time) | ||
| ); | ||
| } |
There was a problem hiding this comment.
makeOlder uses Files.setLastModifiedTime(...) on the provided path; if callers pass a directory (as the current test does), it won’t change the cache file’s timestamp that the caching logic compares. Consider either enforcing/validating that file is the actual cache file path (or updating helper name/docs/call sites accordingly) so the test setup matches what the production code checks.
…rom FpDefaultTest
45e3f98 to
5912526
Compare
|
@yegor256 could you have a look, please? |
…nd FpIfOlder classes
|
@volodya-lombrozo Thanks for the contribution! You've earned +4 points for this: +16 as a basis; -4 for too many hits-of-code (485 >= 100); -8 for way too many hits-of-code (485 >= 400). Please, keep them coming. Your running score is +448; don't forget to check your Zerocracy account too). |
This PR removes unnecessary references to
FpDefaultin theeo-maven-plugintest code, resolving puzzle4851-2fc47960.Fixes #4862
Summary by CodeRabbit