@Test public void testValidateKey() { String[] validKeys = new String[]{"2015ne_frc1124", "2014mar_frc11"}; String[] invalidKeys = new String[]{"2015_frc1124", "2015ne_1124", "f", "", null}; for (String key : validKeys) { assertTrue(DistrictTeamHelper.validateDistrictTeamKey(key)); } for (String key : invalidKeys) { assertFalse(DistrictTeamHelper.validateDistrictTeamKey(key)); } }
public static boolean validateDistrictTeamKey(String key) { if (key == null || key.isEmpty() || !key.contains("_")) { return false; } String districtKey = key.split("_")[0]; String teamKey = key.split("_")[1]; return TeamHelper.validateTeamKey(teamKey) && DistrictHelper.validateDistrictKey(districtKey); }
DistrictTeamHelper { public static boolean validateDistrictTeamKey(String key) { if (key == null || key.isEmpty() || !key.contains("_")) { return false; } String districtKey = key.split("_")[0]; String teamKey = key.split("_")[1]; return TeamHelper.validateTeamKey(teamKey) && DistrictHelper.validateDistrictKey(districtKey); } }
DistrictTeamHelper { public static boolean validateDistrictTeamKey(String key) { if (key == null || key.isEmpty() || !key.contains("_")) { return false; } String districtKey = key.split("_")[0]; String teamKey = key.split("_")[1]; return TeamHelper.validateTeamKey(teamKey) && DistrictHelper.validateDistrictKey(districtKey); } private  DistrictTeamHelper(); }
DistrictTeamHelper { public static boolean validateDistrictTeamKey(String key) { if (key == null || key.isEmpty() || !key.contains("_")) { return false; } String districtKey = key.split("_")[0]; String teamKey = key.split("_")[1]; return TeamHelper.validateTeamKey(teamKey) && DistrictHelper.validateDistrictKey(districtKey); } private  DistrictTeamHelper(); static boolean validateDistrictTeamKey(String key); static String getDistrictKey(String districtTeamKey); static String getTeamKey(String districtTeamKey); static String generateKey(String teamKey, String districtKey); }
DistrictTeamHelper { public static boolean validateDistrictTeamKey(String key) { if (key == null || key.isEmpty() || !key.contains("_")) { return false; } String districtKey = key.split("_")[0]; String teamKey = key.split("_")[1]; return TeamHelper.validateTeamKey(teamKey) && DistrictHelper.validateDistrictKey(districtKey); } private  DistrictTeamHelper(); static boolean validateDistrictTeamKey(String key); static String getDistrictKey(String districtTeamKey); static String getTeamKey(String districtTeamKey); static String generateKey(String teamKey, String districtKey);  }