@@ -0,0 +1,1833 @@
+package study.hard.javalib.calendar;%0A%0Aimport java.util.Calendar;%0Aimport java.util.Date;%0A%0Aimport org.apache.commons.lang.time.DateUtils;%0Aimport org.junit.Test;%0A%0Apublic class CalendarTest %7B%0A%0A%09@Test%0A%09public void testBefore() %7B%0A%09%09Date now = new Date();%0A%09%09Date fromDate = DateUtils.addMonths(now, -1);%0A%09%09Date toDate = now;%0A%0A%09%09Date truncatedFromDate = DateUtils.truncate(fromDate, Calendar.DATE);%0A%09%09Date truncatedToDate = DateUtils.truncate(toDate, Calendar.DATE);%0A%0A%09%09Calendar calendar = Calendar.getInstance();%0A%09%09calendar.setTime(truncatedFromDate);%0A%09%09calendar.add(Calendar.MONTH, 1);%0A%0A%09%09Boolean before;%0A%09%09before = calendar.getTime().before(truncatedToDate);%0A%09%09System.out.println(truncatedFromDate);%0A%09%09System.out.println(truncatedToDate);%0A%09%09System.out.println(before);%0A%0A%09%09truncatedToDate = DateUtils.truncate(DateUtils.addDays(toDate, -2), Calendar.DATE);%0A%09%09before = calendar.getTime().before(truncatedToDate);%0A%09%09System.out.println(truncatedFromDate);%0A%09%09System.out.println(truncatedToDate);%0A%09%09System.out.println(before);%0A%09%7D%0A%0A%09@Test%0A%09public void testBefore2() %7B%0A%09%09Date now = new Date();%0A%09%09Date fromDate = DateUtils.addMonths(now, -1);%0A%09%09Date toDate = now;%0A%0A%09%09Date truncatedFromDate = DateUtils.truncate(fromDate, Calendar.DATE);%0A%09%09Date truncatedToDate = DateUtils.truncate(toDate, Calendar.DATE);%0A%0A%09%09Calendar calendar = Calendar.getInstance();%0A%09%09calendar.setTime(truncatedFromDate);%0A%09%09calendar.add(Calendar.MONTH, 1);%0A%0A%09%09Boolean before;%0A%09%09before = calendar.before(truncatedToDate);%0A%09%09System.out.println(truncatedFromDate);%0A%09%09System.out.println(truncatedToDate);%0A%09%09System.out.println(before);%0A%0A%09%09truncatedToDate = DateUtils.truncate(DateUtils.addDays(toDate, 4), Calendar.DATE);%0A%09%09before = calendar.before(truncatedToDate);%0A%09%09System.out.println(truncatedFromDate);%0A%09%09System.out.println(truncatedToDate);%0A%09%09System.out.println(before);%0A%09%7D%0A%0A%7D%0A

Add test code to use Calendar class.