test(aspect migration mutator): Automated tests for implementations o…#16872
test(aspect migration mutator): Automated tests for implementations o…#16872gdatahub wants to merge 5 commits into
Conversation
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| @BeforeMethod | ||
| public void setUp() { | ||
| entityRegistry = new TestEntityRegistry(); | ||
| AspectRetriever mockRetriever = mock(AspectRetriever.class); |
There was a problem hiding this comment.
Will need this retriver mocks behaviour be customized by each subclass. Some of them may need to use the retriever to compute the transform.
There was a problem hiding this comment.
Good Point. Added a method configureRetrieverMock(@Nonnull AspectRetriever retrieverMock) that is invoked at the end of setUp(), this hook handles subclasses that need common retriever setup across all tests .
A subclass whose mutator calls
retrieverContext.getAspectRetriever().getLatestAspect(...) can override this and add stubs:
@Override
protected void configureRetrieverMock(AspectRetriever retrieverMock) {
when(retrieverMock.getLatestAspect(any(), eq("ownership")))
.thenReturn(someAspect);
}
| } | ||
|
|
||
| @Test | ||
| public void writeMutation_alreadyAtTargetVersion_isNoOp() { |
There was a problem hiding this comment.
this isnt really testing the mutator implementation -- this is pretty much the base class test, so doesnt need to run on each subclass. Same with a few other such methods. All we need to test here - is use sourceAspect and assertTransform with suitable retriever mocking (which is very mutator implementation specific). The retriever may be used by the mutator to fetch some other value in order to compute what the transform should be. Rest are really base class tests
There was a problem hiding this comment.
Made the following changes:
- Removed writeMutation_alreadyAtTargetVersion_isNoOp, readMutation_alreadyAtTargetVersion_isNoOp, and writeMutation_futureVersion_isNoOp, as these base-class version-gating tests are already covered by AspectMigrationMutatorTest.
- Added configureRetrieverMock(AspectRetriever) hook so subclasses can stub retriever behavior specific to their transform logic. mockRetriever is also exposed as a field for per-test verify() calls.
- Kept contract_targetVersionIsSourceVersionPlusOne and contract_sourceVersionAtLeastDefault as lightweight checks to ensure each concrete implementation correctly declares its version numbers.
|
🔴 Meticulous spotted visual differences in 1 of 1181 screens tested: view and approve differences detected. Meticulous evaluated ~6 hours of user flows against your PR. Last updated for commit |
|
Linear: PFP-3221 |
1d71b8d to
d29d5cf
Compare
d29d5cf to
968c368
Compare
…f Abstract AspectMigrationMutators
1824601 to
8cce440
Compare
|
Your PR has been assigned to @chakru-r (chakru.racharla) for review (PFP-3221). |
…f Abstract AspectMigrationMutators
Automated tests for implementations of Abstract AspectMigrationMutators
Two approaches: