def _find_java_tests()

in testinggame/__init__.py [0:0]


def _find_java_tests(blame_lines, names):
    """
    Finds the number of Java test cases per user. This will find tests both
    with the @Test annotation and the standard test methods.

    Args:
        blame_lines: An array where each index is a string containing the git
        blame line.
        names: The current dictionary containing the usernames as a key and the
        number of tests as a value.
    Returns:
        A dictionary built off the names argument containing the usernames as a
        key and the number of tests as a value.
    """
    next_is_test = False
    for blame_line in blame_lines:
        separator = blame_line.find(')')
        blame_code_nospaces = blame_line[separator+1:]
        blame_code_nospaces = blame_code_nospaces.replace(' ', '')
        blame_code_nospaces = blame_code_nospaces.replace('\t', '')
        if next_is_test or blame_code_nospaces.startswith('publicvoidtest'):
            name = _find_name_from_blame(blame_line)
            name_count = names.get(name, 0)
            names[name] = name_count + 1
            next_is_test = False
        else:
            next_is_test = blame_code_nospaces.startswith('@Test')
    return names