ChinaDate { public static Map<String, Integer> lunarToSolar(int year, int month, int day) { String monthStr = month < 10 ? "0" + month : "" + month; String dayStr = day < 10 ? "0" + day : "" + day; String dateStr = year + "-" + monthStr + "-" + dayStr; String sonarStr = null; try { sonarStr = lunarToSolar(dateStr); } catch (Exception e) { System.err.println("lunarToSolar, param error" + e); } Map<String, Integer> data = null; if (sonarStr != null) { data = new HashMap<>(); String[] str = sonarStr.split("-"); data.put("year", Integer.parseInt(str[0])); data.put("month", Integer.parseInt(str[1])); data.put("day", Integer.parseInt(str[2])); } return data; }  static Map<String, Integer> lunarToSolar(int year, int month, int day); static String lunarToSolar(String lunarDate); static Map<String, Integer> solarToLunar(int year, int month, int day); static String solarToLunar(String solarDate, Boolean isFormat);  }
@Test public void lunarToSolar() throws Exception { String lunarDate1 = "1992-12-24"; String lunarDate2 = "1993-12-24"; String expectSolarDate1 = "1993-01-16"; String expectSolarDate2 = "1994-02-04"; String solarDateResult1 = ChinaDate.lunarToSolar(lunarDate1); String solarDateResult2 = ChinaDate.lunarToSolar(lunarDate2); assertTrue(expectSolarDate1.equals(solarDateResult1)); assertTrue(expectSolarDate2.equals(solarDateResult2)); }