Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am looking for update in a DateObjTest jUnit ( Test Code) class which will be according to requirement 8. Requirements 1. Download the starter
I am looking for update in a DateObjTest jUnit (Test Code) class which will be according to requirement 8.
Requirements 1. Download the starter file Date Obj.java". Enhance the DateObj class so that it correctly calculates the next date, given some other date. For example, the next date after April 5 2019 is April 6 2019 2. It should correctly handle the following date calculation challenges: a. Handle the various month lengths b. Handle leap years c. Handle transition to next month and next year 3. The input must be a legitimate date. If it is not, throw an IllegalArgumentException 4. The result must be a legitimate date 5. It must work for dates in the past and in the future 6. Provide unit tests to verify each of the above 7. You may not use Java data and calendar classes 8. Execute test cases for achieving full a)statement coverage, b) decision/branch coverage and c) condition coverage. a. If you couldn't cover all statements, branches and conditions implement more test cases to do so. If not possible, consider why. Deliverables 1. A project zip file : a. The source code of the DateObj class. b. The source code of the JUnit test DateObjTest. c. A pdf file contains : screenshots of the testcases execution results and coverage results public class DateObj { private int year; private int month; private int day; private int[] monthLengths = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; public DateObj(int year, int month, int day) { this.year = year; this.month = month; this.day = day; validate(); public DateObj nextDate() { // TODO: return the next valid date after this one return null; } @Override public String toString() { return String.format("Date [year: %d, month: %, day: %d]", year, month, day); } private void validate() { // TODO: throw an exception if the current values of year, month and day do not make a valid date } } Requirements 1. Download the starter file Date Obj.java". Enhance the DateObj class so that it correctly calculates the next date, given some other date. For example, the next date after April 5 2019 is April 6 2019 2. It should correctly handle the following date calculation challenges: a. Handle the various month lengths b. Handle leap years c. Handle transition to next month and next year 3. The input must be a legitimate date. If it is not, throw an IllegalArgumentException 4. The result must be a legitimate date 5. It must work for dates in the past and in the future 6. Provide unit tests to verify each of the above 7. You may not use Java data and calendar classes 8. Execute test cases for achieving full a)statement coverage, b) decision/branch coverage and c) condition coverage. a. If you couldn't cover all statements, branches and conditions implement more test cases to do so. If not possible, consider why. Deliverables 1. A project zip file : a. The source code of the DateObj class. b. The source code of the JUnit test DateObjTest. c. A pdf file contains : screenshots of the testcases execution results and coverage results public class DateObj { private int year; private int month; private int day; private int[] monthLengths = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; public DateObj(int year, int month, int day) { this.year = year; this.month = month; this.day = day; validate(); public DateObj nextDate() { // TODO: return the next valid date after this one return null; } @Override public String toString() { return String.format("Date [year: %d, month: %, day: %d]", year, month, day); } private void validate() { // TODO: throw an exception if the current values of year, month and day do not make a valid date } }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started