@Test public void parseToday_todayなし() { String input = "2012/10/01"; String actual = AntParameterUtil.parseToday(input); assertEquals(input, actual); }
public static String parseToday(String s) { if (s == null) { return s; } Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?"); Matcher matcher = pattern.matcher(s); if (!matcher.matches()) { return s; } Calendar cal = Calendar.getInstance(); String n = matcher.group(1); if (n != null) { cal.add(Calendar.DATE, -1 * Integer.parseInt(n)); } return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()); }
AntParameterUtil { public static String parseToday(String s) { if (s == null) { return s; } Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?"); Matcher matcher = pattern.matcher(s); if (!matcher.matches()) { return s; } Calendar cal = Calendar.getInstance(); String n = matcher.group(1); if (n != null) { cal.add(Calendar.DATE, -1 * Integer.parseInt(n)); } return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()); } }
AntParameterUtil { public static String parseToday(String s) { if (s == null) { return s; } Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?"); Matcher matcher = pattern.matcher(s); if (!matcher.matches()) { return s; } Calendar cal = Calendar.getInstance(); String n = matcher.group(1); if (n != null) { cal.add(Calendar.DATE, -1 * Integer.parseInt(n)); } return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()); } private  AntParameterUtil(); }
AntParameterUtil { public static String parseToday(String s) { if (s == null) { return s; } Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?"); Matcher matcher = pattern.matcher(s); if (!matcher.matches()) { return s; } Calendar cal = Calendar.getInstance(); String n = matcher.group(1); if (n != null) { cal.add(Calendar.DATE, -1 * Integer.parseInt(n)); } return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()); } private  AntParameterUtil(); static String getReportOutput(String s); static String parseToday(String s); }
AntParameterUtil { public static String parseToday(String s) { if (s == null) { return s; } Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?"); Matcher matcher = pattern.matcher(s); if (!matcher.matches()) { return s; } Calendar cal = Calendar.getInstance(); String n = matcher.group(1); if (n != null) { cal.add(Calendar.DATE, -1 * Integer.parseInt(n)); } return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()); } private  AntParameterUtil(); static String getReportOutput(String s); static String parseToday(String s);  }