Java unit test Judgment of specified day of the week Determines whether ArDate, Date, Calendar, and long are specified days of the week.

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

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 Same day judgment ArDate, Date, Calendar, long ignore the time and judge whether they are the same day
Display Japanese calendar and days of the week using java8 standard class
[Java] Calculate the day of the week from the date (Calendar class is not used)
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
[Java1.8 +] Get the date of the next x day of the week with LocalDate
This and that of the implementation of date judgment within the period in Java
[Ubuntu 20.04] Display the day of the week on the date / clock
[Java] Get the date 10 days later with the Calendar class
Output of the day of the week using Ruby's Date class
Was done in the base year of the Java calendar week
Get the next business day after the specified date in JAVA
[Ruby] Display today's day of the week using Date class