Exemple #1
0
 def test_find_protected_method(self):
     filepath = self.current_directory / "ProtectedMethod.java"
     ast = AST.build_from_javalang(build_ast(filepath))
     pattern = ProtectedMethod()
     lines = pattern.value(ast)
     self.assertEqual(lines, [2, 6],
                      "Should match pattern protected method")
Exemple #2
0
 def test_find_protected_method_anonymous(self):
     self.assertEqual(
         [5],
         ProtectedMethod().value(
             Path(self.dir_path, 'AnonymousClassProtectedMethod.java')),
         'Should match pattern protected method in anonymous class')
Exemple #3
0
 def test_not_find_protected_method(self):
     self.assertEqual([],
                      ProtectedMethod().value(
                          Path(self.dir_path, 'NoProtectedMethod.java')),
                      'Should not match pattern protected method')
Exemple #4
0
 def test_find_protected_method_inner(self):
     self.assertEqual(
         [2, 11],
         ProtectedMethod().value(
             Path(self.dir_path, 'InnerClassProtectedMethod.java')),
         'Should match pattern protected method in inner class')