@TestVisible is ignored for private methods
Issue #1538
resolved
The latest release of IC introduced a regression regarding the visibility of private methods which are overridden.
We are using the @TestVisible annotation for private virtual methods in order to mock/stub methods for testing. Now all private methods are marked as having an error. See also the attached screenshot.
Given
public virtual with sharing class TestPrivateMethod {
@TestVisible
private virtual void foo() {
}
}
@TestVisible
@IsTest
private class TestPrivateMethodMock extends TestPrivateMethod {
private override void foo() {
}
}
Expected
@TestVisible should be treated like protected/public and not produce an error like that.
Impact
All classes do have multiple error annotations, making it impossible to find 'real' issues without deploying the code to Salesforce.
Comments (3)
-
repo owner -
reporter Thanks for the swift reply and confirmation. Much appreciated.
-
repo owner - changed status to resolved
I fixed this way-back-when but never resolved the issue here.
- Log in to comment
Ah...duh on my part. I'll fix that in the next build. It's a benign warning, but it's obviously misleading and annoying. Thanks for letting me know!