def test_sync_with_class_this(self):
     """ Handles the case
     # synchronized(AsyncCallHandler.this)
     # {
     #     AsyncCallHandler.this.wait(waitTime);
     # }
     """
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Object.This.java')
     self.assertEqual(lines, [161])
 def test_sync_sequential(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/SeveralCases.java')
     self.assertEqual(lines, [85, 91, 98])
 def test_sync_with_large_file(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Large.java')
     self.assertEqual(lines, [1359, 1546, 1584, 1606, 1628, 3347])
 def test_nested_sync(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/NestedSync.java')
     self.assertEqual(lines, [22, 24])
 def test_sync_with_class_field(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/FieldClass.java')
     self.assertEqual(lines, [154])
 def test_sync_with_func_call(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/FuncCall.java')
     self.assertEqual(lines, [45])
 def test_sync_with_array(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/ArrayIndex.java')
     self.assertEqual(lines, [89])
 def test_sync_with_static_class(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) +
         '/SyncStaticClass.java')
     self.assertEqual(lines, [52])
 def test_lambda(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Lambda.java')
     self.assertEqual(lines, [28])
 def test_simple(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Simple.java')
     self.assertEqual(lines, [22])
 def test_ctor(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Constructor.java')
     self.assertEqual(lines, [412])
 def test_sync_with_func_ref(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/SyncWithFunc.java')
     self.assertEqual(lines, [228])
 def test_sync_with_nested_if_and_for(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/WIthIf.java')
     self.assertEqual(lines, [85])
 def test_sync_in_different_functions(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) +
         '/SeveralFunctions.java')
     self.assertEqual(lines, [22, 38, 40])
 def test_sync_with_method_chaining(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) + '/Chain.java')
     self.assertEqual(lines, [183])
 def test_sync_with_statements_after_it(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) +
         '/SimpleThisAfter.java')
     self.assertEqual(lines, [22, 24])
 def test_sync_with_empty_lines_before_it(self):
     pattern = PartialSync()
     lines = pattern.value(
         os.path.dirname(os.path.realpath(__file__)) +
         '/SimpleThisEmptyLineBefore.java')
     self.assertEqual(lines, [])