@Test public void testValidateKey() { String[] validKeys = new String[]{"frc1124", "frc254"}; String[] invalidKeys = new String[]{null, "", "1124", "frc", "frc11245", "frc254B"}; for (String key : validKeys) { assertTrue(TeamHelper.validateTeamKey(key)); } for (String key : invalidKeys) { assertFalse(TeamHelper.validateTeamKey(key)); } }
public static boolean validateTeamKey(@Nullable String key) { return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$"); }
TeamHelper { public static boolean validateTeamKey(@Nullable String key) { return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$"); } }
TeamHelper { public static boolean validateTeamKey(@Nullable String key) { return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$"); } private  TeamHelper(); }
TeamHelper { public static boolean validateTeamKey(@Nullable String key) { return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$"); } private  TeamHelper(); static boolean validateTeamKey(@Nullable String key); static boolean validateMultiTeamKey(@Nullable String key); static String baseTeamKey(@Nullable String teamKey); static int getTeamNumber(@Nullable String key); }
TeamHelper { public static boolean validateTeamKey(@Nullable String key) { return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$"); } private  TeamHelper(); static boolean validateTeamKey(@Nullable String key); static boolean validateMultiTeamKey(@Nullable String key); static String baseTeamKey(@Nullable String teamKey); static int getTeamNumber(@Nullable String key);  }