Table of Contents ⇒ Java Unit Test Library-Artery-Sample
package jp.avaj.lib.test;
import java.util.Calendar;
import jp.avaj.lib.algo.ArDateUtil;
import jp.avaj.lib.algo.ArYoubi;
/**
Java Unit Test Specified Day of the Week Judgment ArDate,Date,Calendar,Determine if long is the specified day of the week.
・ In this sample, determine whether Calendar is the specified day of the week..
*/
public class Q05_03 {
public static void main(String[] args) {
//Start a test case-Not required if aggregation is not required.
ArTest.startTestCase("Q05_03");
//The day of the week you want to check-Tuesday
ArYoubi youbi = ArYoubi.TUE;
Calendar cal;
cal = ArDateUtil.getCalendar(2030,7,1,12,0,0); //Monday
//Check just in case
L.p("cal="+ArDateUtil.getYoubi(cal));
//Determine the day of the week
ArTest.youbiEquals("Q05_03(NG)","cal",cal,"youbi",youbi);
//Advance the day(1 day, 0 hours, 0 minutes, 0 seconds)
cal = ArDateUtil.forward(cal,1,0,0,0);
//Determine the day of the week
ArTest.youbiEquals("Q05_03(OK)","cal",cal,"youbi",youbi);
//Advance seven days
cal = ArDateUtil.forward(cal,7,0,0,0);
//Determine the day of the week
ArTest.youbiEquals("Q05_03(OK)","cal",cal,"youbi",youbi);
//End the test case-Not required if aggregation is not required
ArTest.endTestCase();
}
}
The result is as follows.
result.txt
**** Q05_03 start ****
cal=(Month)
NG Q05_03(NG):cal=2030/07/01 12:00:00:youbi=(fire)
jp.avaj.lib.test.Q05_03.main(Q05_03.java:26)
OK Q05_03(OK):cal=2030/07/02 12:00:00:youbi=(fire)
OK Q05_03(OK):cal=2030/07/09 12:00:00:youbi=(fire)
**** Q05_03 summary ****
test count = 3
success = 2
Recommended Posts