Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 FutureDate 10 marks In this problem you will implement a single static method that outputs an array of black-box test cases for the futureDate)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1 FutureDate 10 marks In this problem you will implement a single static method that outputs an array of black-box test cases for the futureDate) method from Tutorial 5. The method you will implement, in the TestFutureDate class, is specified as follows Generate black-box test cases for the futureDate method The API for the futureDate) method is provided in this Assignment document * Greturn an array of test cases for the futureDate) method public static FutureDateTestCase makeTestCases O...h Each test case consists of a Date object, an integer (that is the number of days in the future), and another Date object that is the expected date in the future. For example, consider Date day-new Date (2019, 1, 1); int daysInFuture-2; Date expectednew Date (2019, 1, 1+daysInFuture) FutureDateTestCase testcase new FutureDateTestCase (day, daysInFuture, expected); This creates a test case to check that the expected Date is 2 days in the future from the day object. That is, it checks that January 3, 2019 is 2 days in the future from January 1, 2019. This is a valid test case because the expected output is correct Each of your test cases will first be run with a correct implementation of the futureDate () method. If the actual output matches the expected output (specified in the test case) then that test case is deemed to be valid. Each valid test case will then be run with several alternate versions of the method that have bugs in them. Test cases that are invalid will be discarded. A bug is exposed each time a valid test case fails in an alternate version of the method. That is, when the outcome of the method does not match the expected outcome of the test case then something went wrong in the method (and hence a bug is exposed). A failed test case does not necessarily indicate what or where the bug is but it does let you know that a bug exists Your goal is to generate a collection of valid test cases that expose a bug in each of the alternate versions (buggy versions) that we will have on the server. Your grade will be determined by the number of alternate versions that you find a bug in. The API for the futureDate ) method is as follows: /** Creates a new date object that is some specified number of days * in the future from date object calling it. *Precondition: the current Date object calling this method will always c orrespond to a date tht is NOT further in the past than August 26, 1735. * Oparam daysInFuture is a non-negative integer (the number of days from this date that the new returned date object will be created) * Greturn a new Date obiect that is daysInFuture past this current date. public Date futureDate(int daysInFuture)... /** A c1a35 for blackbox te ting */ public class EutureDate protected static int[] days1nMonth {31,28,31,30,31,30,31,31,30,31,30,31}; protected static String[] months"January", "February"March", "April","May","June"July","August", "September","October", "November","December" **Creates a new futuredate object that is nDays in the future from this current futuredate object

Example: d.makeFutureDate (0) wi1l create a new futuredate object that is the same date a3 fd

Example: fd.makeFutureDate(1) will create a new futuredate object that 15 1 day after the uturedate Id

Example: Ed.makeFutureDate (3) will create a new futuredate object that is 3 days p5t the futuredate fd 8param nDays is a non-negative integer (the number ot days from this futuredate that the new returned futuredate object will be created) * @return a new futuredate object that 1 nDays pa t thi current futureaate. public FutureDate makeFutureDate (int nDays) if( this. day + nDays Example: d.makeFutureDate (0) wi1l create a new futuredate object that is the same date a3 fd

Example: fd.makeFutureDate(1) will create a new futuredate object that 15 1 day after the uturedate Id

Example: Ed.makeFutureDate (3) will create a new futuredate object that is 3 days p5t the futuredate fd 8param nDays is a non-negative integer (the number ot days from this futuredate that the new returned futuredate object will be created) * @return a new futuredate object that 1 nDays pa t thi current futureaate. public FutureDate makeFutureDate (int nDays) if( this. day + nDays

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Evaluate criticisms of DSM-5.

Answered: 1 week ago

Question

Summarize various training methods.

Answered: 1 week ago

Question

Explain the metrics for evaluating training and development.

Answered: 1 week ago

Question

Identify career planning approaches.

Answered: 1 week ago