@testVisible false negative inspections
Issue #827
resolved
It might be strange that Apex allows this, but we've done it throughout some of our code bases.
public class ProductionClass {
@testVisible private String name;
}
@isTest
private class ProductionClassTest {
private class ProductionClassStub extends ProductionClass {
public ProductionClassStub() {
this.name = 'foo';
}
}
}
The statement this.name = 'foo'
is telling us "Cannot resolve symbol 'name'".
Comments (5)
-
repo owner -
repo owner Easily reproduced with the sample you provided. Just had to mark the base class as
virtual
. Should be pretty easy to address as well. -
repo owner Aaaannnnd...fixed. All the logic was there, but it was checking to see if the class containing the reference was a test class to decide whether to look at
@TestVisible
. The inner class isn't a test class even though it's contained within one. I changed it to see if the top-level class is a test class. The fix will be in the next build. -
Account Deactivated reporter Thanks Scott!
-
repo owner - changed status to resolved
Delivered in 2.0.0.3 for IC2. Let me know if you see any other false positives/negatives.
- Log in to comment
Thanks for reporting, Matt. Strange or not, it's valid syntax. I'll take a look for the next build.