Java Unit Test Library-Determine if Artery-Date, Calendar, long is the current date and time (specify tolerance in minutes)

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

Java Unit Test Library-Determine if Artery-Date, Calendar, long is the current date and time (specify tolerance in minutes)
[Java] How to get the current date and time and specify the display format
Java unit test Judgment of specified day of the week Determines whether ArDate, Date, Calendar, and long are specified days of the week.
What is the LocalDateTime class? [Java beginner] -Date and time class-
Java unit test Judgment of specified day of the week Determines whether ArDate, Date, Calendar, and long are specified days of the week.
Java Unit Test Library-Determine if Artery-Date, Calendar, long is the current date and time (specify tolerance in minutes)
Java Unit Test Library-Artery-Current Date Judgment
[Java] Method call error when inheritance and interface implementation are performed at the same time
What is the LocalDateTime class? [Java beginner] -Date and time class-
[Java] Use ResolverStyle.LENIENT to handle the date and time nicely
The relationship between strict Java date checking and daylight savings time
Get the current date and time by specifying the time zone in Thymeleaf
Parse the date and time string formatted by the C asctime function in Java
[Java] Use ResolverStyle.LENIENT to handle the date and time nicely
View current date in Java
The design concept of Java's Date and Time API is interesting
The relationship between strict Java date checking and daylight savings time