Table of Contents ⇒ Java Unit Test Library-Artery-Sample
package jp.avaj.lib.test;
import java.util.Calendar;
import jp.avaj.lib.algo.ArDateUtil;
/**
*Java unit test library-Artery-Date,Calendar,Determine if long is the current date and time(Specify the tolerance in minutes)
*
*In this example, the case of Calendar is shown..
*/
public class Q05_01 {
public static void main(String[] args) {
//Start a test case-Not needed if you don't aggregate the results
ArTest.startTestCase("Q05_01");
//Get the current date and time
Calendar cal = ArDateUtil.getCalendar();
//Determine if it is the current date and time,Judgment error is 1 minute ⇒ OK
ArTest.currentTime("Current date and time judgment","cal",cal,1);
//Advance five minutes, day, hour, minute, second
cal = ArDateUtil.forward(cal,0,0,5,0);
//Determine if it is the current date and time,Judgment error is 1 minute ⇒ NG
ArTest.currentTime("Current date and time judgment","cal",cal,1);
//End the test case-Not needed if you don't aggregate the results
ArTest.endTestCase();
}
}
The result is as follows
result.txt
**** Q05_01 start ****
OK Current date and time judgment:cal=2019/10/07 06:27:56
NG Current date and time judgment:cal=2019/10/07 06:32:56
jp.avaj.lib.test.Q05_01.main(Q05_01.java:26)
**** Q05_01 summary ****
test count = 2
success = 1
Recommended Posts