@Test public void testValidateEventTeamKey() { String[] validKeys = new String[]{"2015arc_frc1124", "2015gal_frc254", "2015gal_frc254B"}; String[] invalidKeys = new String[]{null, "", "1124", "frc", "frc11245", "frc254B", "2015arc", "2015arc_", "2015arc_frc"}; for (String key : validKeys) { assertTrue(EventTeamHelper.validateEventTeamKey(key)); } for (String key : invalidKeys) { assertFalse(EventTeamHelper.validateEventTeamKey(key)); } }
public static boolean validateEventTeamKey(String key) { if (key == null || TextUtils.isEmpty(key)) { return false; } String[] split = key.split("_"); return split.length == 2 && EventHelper.validateEventKey(split[0]) && (TeamHelper.validateTeamKey(split[1]) ^ TeamHelper.validateMultiTeamKey(split[1])); }
EventTeamHelper { public static boolean validateEventTeamKey(String key) { if (key == null || TextUtils.isEmpty(key)) { return false; } String[] split = key.split("_"); return split.length == 2 && EventHelper.validateEventKey(split[0]) && (TeamHelper.validateTeamKey(split[1]) ^ TeamHelper.validateMultiTeamKey(split[1])); } }
EventTeamHelper { public static boolean validateEventTeamKey(String key) { if (key == null || TextUtils.isEmpty(key)) { return false; } String[] split = key.split("_"); return split.length == 2 && EventHelper.validateEventKey(split[0]) && (TeamHelper.validateTeamKey(split[1]) ^ TeamHelper.validateMultiTeamKey(split[1])); } private  EventTeamHelper(); }
EventTeamHelper { public static boolean validateEventTeamKey(String key) { if (key == null || TextUtils.isEmpty(key)) { return false; } String[] split = key.split("_"); return split.length == 2 && EventHelper.validateEventKey(split[0]) && (TeamHelper.validateTeamKey(split[1]) ^ TeamHelper.validateMultiTeamKey(split[1])); } private  EventTeamHelper(); static String generateKey(String eventKey, String teamKey); static String getEventKey(String eventTeamKey); static String getTeamKey(String eventTeamKey); static boolean validateEventTeamKey(String key); }
EventTeamHelper { public static boolean validateEventTeamKey(String key) { if (key == null || TextUtils.isEmpty(key)) { return false; } String[] split = key.split("_"); return split.length == 2 && EventHelper.validateEventKey(split[0]) && (TeamHelper.validateTeamKey(split[1]) ^ TeamHelper.validateMultiTeamKey(split[1])); } private  EventTeamHelper(); static String generateKey(String eventKey, String teamKey); static String getEventKey(String eventTeamKey); static String getTeamKey(String eventTeamKey); static boolean validateEventTeamKey(String key);  }