use of net.sourceforge.pmd.lang.java.multifile.signature.JavaSignature.Visibility in project pmd by pmd.
the class JavaMultifileVisitorTest method testFieldsAreThere.
@Test
public void testFieldsAreThere() {
parseAndVisitForClass(MultifileVisitorTestData2.class);
final ProjectMirror toplevel = PackageStats.INSTANCE;
final JavaFieldSigMask fieldSigMask = new JavaFieldSigMask();
JavaTypeQualifiedName clazz = QualifiedNameFactory.ofClass(MultifileVisitorTestData2.class);
String[] fieldNames = { "x", "y", "z", "t" };
Visibility[] visibilities = { Visibility.PUBLIC, Visibility.PRIVATE, Visibility.PROTECTED, Visibility.PACKAGE };
for (int i = 0; i < fieldNames.length; i++) {
fieldSigMask.restrictVisibilitiesTo(visibilities[i]);
assertTrue(toplevel.hasMatchingSig(clazz, fieldNames[i], fieldSigMask));
}
}
use of net.sourceforge.pmd.lang.java.multifile.signature.JavaSignature.Visibility in project pmd by pmd.
the class JavaMultifileVisitorTest method testBothClassesFieldsAreThere.
@Test
public void testBothClassesFieldsAreThere() {
parseAndVisitForClass(MultifileVisitorTestData2.class);
parseAndVisitForClass(MultifileVisitorTestData2.class);
final ProjectMirror toplevel = PackageStats.INSTANCE;
final JavaFieldSigMask fieldSigMask = new JavaFieldSigMask();
JavaTypeQualifiedName clazz = QualifiedNameFactory.ofClass(MultifileVisitorTestData2.class);
JavaTypeQualifiedName clazz2 = QualifiedNameFactory.ofClass(MultifileVisitorTestData2.class);
String[] fieldNames = { "x", "y", "z", "t" };
Visibility[] visibilities = { Visibility.PUBLIC, Visibility.PRIVATE, Visibility.PROTECTED, Visibility.PACKAGE };
for (int i = 0; i < fieldNames.length; i++) {
fieldSigMask.restrictVisibilitiesTo(visibilities[i]);
assertTrue(toplevel.hasMatchingSig(clazz, fieldNames[i], fieldSigMask));
assertTrue(toplevel.hasMatchingSig(clazz2, fieldNames[i], fieldSigMask));
}
}
Aggregations