@Test public void testValidateKey() { String[] validKeys = new String[]{"2015cthar", "2014cmp", "2003moo", "2013moo2"}; String[] invalidKeys = new String[]{null, "", "foobar", "2012"}; for (String key : validKeys) { assertTrue(EventHelper.validateEventKey(key)); } for (String key : invalidKeys) { assertFalse(EventHelper.validateEventKey(key)); } }
public static boolean validateEventKey(String key) { if (key == null || key.isEmpty()) return false; return key.matches("^[1-9]\\d{3}[a-z,0-9]+$"); }
EventHelper { public static boolean validateEventKey(String key) { if (key == null || key.isEmpty()) return false; return key.matches("^[1-9]\\d{3}[a-z,0-9]+$"); } }
EventHelper { public static boolean validateEventKey(String key) { if (key == null || key.isEmpty()) return false; return key.matches("^[1-9]\\d{3}[a-z,0-9]+$"); } private  EventHelper(); }
EventHelper { public static boolean validateEventKey(String key) { if (key == null || key.isEmpty()) return false; return key.matches("^[1-9]\\d{3}[a-z,0-9]+$"); } private  EventHelper(); static boolean validateEventKey(String key); static String shortName(String eventName); static int getYear(String eventKey); static int getYearWeek(Date date); static int competitionWeek(Date date); static String generateLabelForEvent(Event e); static String weekLabelFromNum(int year, @Nullable Integer weekNum); static int weekNumFromLabel(int year, String label); static void renderEventListForTeam(Context context,List<Event> events, List<Object> output); static void renderEventListForWeek(Context context, List<Event> events, List<Object> output); static void renderEventListForDistrict(
            Context context,
            List<Event> events,
            List<Object> output); static String getDateString(Date startDate, Date endDate); static String getShortCodeForEventKey(String eventKey); static String getEventCode(String matchOrEventOrDistrictKey); }
EventHelper { public static boolean validateEventKey(String key) { if (key == null || key.isEmpty()) return false; return key.matches("^[1-9]\\d{3}[a-z,0-9]+$"); } private  EventHelper(); static boolean validateEventKey(String key); static String shortName(String eventName); static int getYear(String eventKey); static int getYearWeek(Date date); static int competitionWeek(Date date); static String generateLabelForEvent(Event e); static String weekLabelFromNum(int year, @Nullable Integer weekNum); static int weekNumFromLabel(int year, String label); static void renderEventListForTeam(Context context,List<Event> events, List<Object> output); static void renderEventListForWeek(Context context, List<Event> events, List<Object> output); static void renderEventListForDistrict(
            Context context,
            List<Event> events,
            List<Object> output); static String getDateString(Date startDate, Date endDate); static String getShortCodeForEventKey(String eventKey); static String getEventCode(String matchOrEventOrDistrictKey); static final String CHAMPIONSHIP_LABEL; static final String CITY_CHAMPIONSHIP_LABEL; static final String REGIONAL_LABEL; static final String FLOAT_REGIONAL_LABEL; static final String WEEKLESS_LABEL; static final String OFFSEASON_LABEL; static final String PRESEASON_LABEL; }