def __init__(self, java_class): self.java_class = java_class first_data_file_name = "of{version}/{name}.data".format(version=java_class.version.of_version, name=java_class.c_name[3:]) data_file_template = "of{version}/{name}.".format(version=java_class.version.of_version, name=java_class.c_name[3:]) + "{i}.data" test_class_name = self.java_class.name + "Test" self.test_units = [] if test_data.exists(first_data_file_name): self.test_units.append(JavaUnitTest(java_class, first_data_file_name, test_class_name)) i = 1 while test_data.exists(data_file_template.format(i=i)): self.test_units.append(JavaUnitTest(java_class, data_file_template.format(i=i), test_class_name + str(i))) i = i + 1
def __init__(self, java_class): self.java_class = java_class first_data_file_name = "of{version}/{name}.data".format( version=java_class.version.dotless_version, name=java_class.c_name[3:]) glob_file_name = "of{version}/{name}__*.data".format( version=java_class.version.dotless_version, name=java_class.c_name[3:]) test_class_name = self.java_class.name + "Test" self.test_units = [] if test_data.exists(first_data_file_name): self.test_units.append( JavaUnitTest(java_class, first_data_file_name, test_class_name)) i = 1 for f in test_data.glob(glob_file_name): m = re.match(".*__(.*).data", f) if m: suffix = java_type.name_c_to_caps_camel(m.group(1)) else: suffix = str(i) i += 1 test_class_name = self.java_class.name + suffix + "Test" self.test_units.append(JavaUnitTest(java_class, f, test_class_name))
def __init__(self, java_class): self.java_class = java_class first_data_file_name = "of{version}/{name}.data".format(version=java_class.version.dotless_version, name=java_class.c_name[3:]) glob_file_name = "of{version}/{name}__*.data".format(version=java_class.version.dotless_version, name=java_class.c_name[3:]) test_class_name = self.java_class.name + "Test" self.test_units = [] if test_data.exists(first_data_file_name): self.test_units.append(JavaUnitTest(java_class, first_data_file_name, test_class_name)) i = 1 for f in test_data.glob(glob_file_name): m = re.match(".*__(.*).data", f) if m: suffix = java_type.name_c_to_caps_camel(m.group(1)) else: suffix = str(i) i += 1 test_class_name = self.java_class.name + suffix + "Test" self.test_units.append(JavaUnitTest(java_class, f, test_class_name))
def has_test_data(self): return test_data.exists(self.data_file_name)