MCPcopy Create free account
hub / github.com/6tail/lunar-java / testLunarTimeGanZhi

Method testLunarTimeGanZhi

src/test/java/test/TimeTest.java:220–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218 };
219
220 @Test
221 public void testLunarTimeGanZhi(){
222 for(Map.Entry<String,String> entry:GAN_ZHI.entrySet()){
223 int hour = 0,minute = 0;
224 String time = entry.getKey();
225 int year = Integer.parseInt(time.substring(0,4));
226 int month = Integer.parseInt(time.substring(4,time.indexOf(",")));
227 int day = Integer.parseInt(time.substring(time.indexOf(",")+1,time.lastIndexOf(",")));
228 String hm = time.substring(time.lastIndexOf(",")+1);
229 if(hm.length()>=5){
230 hour = Integer.parseInt(hm.substring(0,2),10);
231 minute = Integer.parseInt(hm.substring(3,5),10);
232 }
233 Lunar lunar = Lunar.fromYmdHms(year,month,day,hour,minute,0);
234 String ganZhi = entry.getValue();
235 Assert.assertEquals(lunar.getYear()+"年"+lunar.getMonthInChinese()+"月"+lunar.getDayInChinese()+" "+hm, ganZhi, lunar.getTimeInGanZhi());
236 }
237 }
238 @Test
239 public void testLunarTimeGan(){
240 for(Map.Entry<String,String> entry:GAN.entrySet()){

Callers

nothing calls this directly

Calls 5

fromYmdHmsMethod · 0.95
getYearMethod · 0.95
getMonthInChineseMethod · 0.95
getDayInChineseMethod · 0.95
getTimeInGanZhiMethod · 0.95

Tested by

no test coverage detected