help Day class is given below so create a test for day, addDays, previousDay and
ID: 672471 • Letter: H
Question
help Day class is given below so create a test for day, addDays, previousDay and leapYear using JUnitQuestion 2: Design a test class using the JUnit framework to test the Day class's methods (Implementation I, pages 100 104). You are required to provide a test for the following methods ide a test for the followirn . Day (int aYear, int aMonth, int aDate) e addDays(int n) e previousDay) (Make sure to change the method from private to public for testing purposes in the Day class) · isLeapYear(int y) (Make sure to change the method from private to public for testing purposes in the Day class)
Explanation / Answer
public class DayTest {
public static void main(String[] args) {
Day d=Day(1993,02,12);
Day d0=d.previousDay();
Day d1=d.addDays(2);
int y=1996;
System.out.println("Is "+y+" a leap year: "+d.isLeapYear(y));
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.