Answered step by step
Verified Expert Solution
Question
1 Approved Answer
d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro. COMP 1406 (298 unrea... Get Homework Help Wi... Get Homework Help W... In This Problem, You Wi.. Crosslist BUSINO038 B..
d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro. COMP 1406 (298 unrea... Get Homework Help Wi... Get Homework Help W... In This Problem, You Wi.. Crosslist BUSINO038 B.. In this problem you will implement a single static met hod that ostputs an array of black-box test caws for the futureDate) method from Tutorial 5. The method yos will implement, in the TestFutur Date class, is spocified as follows Generate black-box test cases for the futurebate) ethod * API for the futurelate() method 1B provided 1 thd& ABB ignnent docunent Creturs an array of test cases for the futurebate) method Each test case cousists of a Date objet, all liteger (that is the lumbar of days in the futuro), and anot her Date object that is the expected date in the fut ure. For ecample, consider Date day-teu Date(2019, 1) int dasi Future- 2, Date epected ne Date 2019, , 1 dayaIPu u This creates a test cme to check that the expected Date is 2 daysin the future from the day object nuat is, it dwk, that Jansary 3, 2019 2 days in the future froma January 1, 319 This n valid tast case because the expectod output is cornect Each of your tet cases will finst be nua with a corect implemestation of the futureDateO method If the actwal output matches the expacted out pat (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 vensions of the method that have bags in them. Test cases that are invalid will be discarded A bug is exposed each tim, a valid bast case lails in an alternate nion the method. That , when theoutaatne od the Earthod ekes not match theexpected auteutue of thr tast case thia sonet hing went TOng in the met hod (and hence a bug is exposed). A failed test case does not necessarily indicate what or where the bug is but it does lct you know that a bug exists Your goal is to generate a collection of valid test 83 that expose a bug in cach of the alternate vensions Iy eons) that we will have on the wrVET Your gade will be determined by the mber of alternste wrsioms that you find a ba in COMP1406-Winter 2019 As Due March 1 at 5:30 The APl fir thr futureDate() #act bod is as follows: Creates a neu date object that 18 apecified nusber ot daya iD the future from date object calling Precondnthe current Date object calling thse sethod will lways corr eapond to a date thatNOT Further in the past than ugut 26, 1735 this date that the neu retursed date object vli be created) ereturn a se Date object that is daysInPuture past this current date public Date futureDate(t dayslsPuture). -.. Datejavax : Find. ava FindTestCasejava Grades.java GradesTestCasejava 4FutureDateTestCase ava TestFutureDate java .STestGrades. ava L protected int month; protected int day 1e /*Creates a date with the specified year, month and date. 14 15 16 17 18 public Date(int YYYY, int MM, int DD) *@param YYYY is the year of the date to be created. * @param Mis the month of the date to be created. * @param DD is the day of the date to be created 2e month MM dayDD 23 24 w Getter for the year of this date 25 26 27 public int getYear) return this.year: 28 29* Getter for the nonth of this date * @return the year of this date * @return the month of this date 31 / 32 public int getMonth)f return this.month; 34 w Getter for the day of this date * @return the day of this date 36 * 37 public int getDay()f return this.day; 38 39 Creates a new date object that is nDays in the future from this current date 41 eparam nDays is a non-negative integer (the number of days from this date that the new returned date object will be created). @return a new date object that is nDays past this current date. public Date futureDatelint nDays)( 45 46 47 return null; 49* A string representation of this date * ereturn a string representation of this date as YYYMDD 51 2 e0verride 53 public String toString) 54 return String. fornat("$04d", this.year) trino.format month n 1, Col 1 Tab Size: 2 UTF-8 CRLF Java soe Find.java FindTestCase.java IGrades javaGradesTestcase javali FutureDateTestCasejava x : TestFutureDate.java . . TestGrades.java d? Date java 1 package comp1486a3; 3 public class FutureDateTestCasef Date now; int daysInFuture; Date expected; public Date getNowt) return this.now; h public Date getExpected)f return this.expected; /*A test case for both the futureDate method 10 public int getDays( return this.daysInFuture; ) 13 14 15 16 17 18 19 2e 21 @paran target is the target sequence It is an array of one or more integers " @paran array is an array of zero or more integers * @paran expectedFind is the expected output of Find. LocateSequence target, array) *@paran expectedFindAgain is the expected output of Find. LocateAllsequenceLocations (target.array) 23 24 25 26 27 28 29 3e public FutureDateTestCase(Date now, int daysInFuture, Date expected this now this.daysInFuture-daysInFuture; this.expected expected; = now; ni, Coll Tab Sze: 4 UTF-8 CRLF Java Find.java package comp1486a3; Date java FindTestCase.java Grades java GradesTestCase.java FutureDateTestCasejava TestFutureDate javaTestGrades.java m 3 public class TestFutureDate Generate black-box test cases for the futureDate nethod (in the Date class) @return an array of test cases for the futureDate method (in the Date class). public static FutureDateTestCasell makeTestcases) 1e return null: 12 13 n 13, Col 2 Tab Size: 4 UTF-8 CRLF Java e d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro. COMP 1406 (298 unrea... Get Homework Help Wi... Get Homework Help W... In This Problem, You Wi.. Crosslist BUSINO038 B.. In this problem you will implement a single static met hod that ostputs an array of black-box test caws for the futureDate) method from Tutorial 5. The method yos will implement, in the TestFutur Date class, is spocified as follows Generate black-box test cases for the futurebate) ethod * API for the futurelate() method 1B provided 1 thd& ABB ignnent docunent Creturs an array of test cases for the futurebate) method Each test case cousists of a Date objet, all liteger (that is the lumbar of days in the futuro), and anot her Date object that is the expected date in the fut ure. For ecample, consider Date day-teu Date(2019, 1) int dasi Future- 2, Date epected ne Date 2019, , 1 dayaIPu u This creates a test cme to check that the expected Date is 2 daysin the future from the day object nuat is, it dwk, that Jansary 3, 2019 2 days in the future froma January 1, 319 This n valid tast case because the expectod output is cornect Each of your tet cases will finst be nua with a corect implemestation of the futureDateO method If the actwal output matches the expacted out pat (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 vensions of the method that have bags in them. Test cases that are invalid will be discarded A bug is exposed each tim, a valid bast case lails in an alternate nion the method. That , when theoutaatne od the Earthod ekes not match theexpected auteutue of thr tast case thia sonet hing went TOng in the met hod (and hence a bug is exposed). A failed test case does not necessarily indicate what or where the bug is but it does lct you know that a bug exists Your goal is to generate a collection of valid test 83 that expose a bug in cach of the alternate vensions Iy eons) that we will have on the wrVET Your gade will be determined by the mber of alternste wrsioms that you find a ba in COMP1406-Winter 2019 As Due March 1 at 5:30 The APl fir thr futureDate() #act bod is as follows: Creates a neu date object that 18 apecified nusber ot daya iD the future from date object calling Precondnthe current Date object calling thse sethod will lways corr eapond to a date thatNOT Further in the past than ugut 26, 1735 this date that the neu retursed date object vli be created) ereturn a se Date object that is daysInPuture past this current date public Date futureDate(t dayslsPuture). -.. Datejavax : Find. ava FindTestCasejava Grades.java GradesTestCasejava 4FutureDateTestCase ava TestFutureDate java .STestGrades. ava L protected int month; protected int day 1e /*Creates a date with the specified year, month and date. 14 15 16 17 18 public Date(int YYYY, int MM, int DD) *@param YYYY is the year of the date to be created. * @param Mis the month of the date to be created. * @param DD is the day of the date to be created 2e month MM dayDD 23 24 w Getter for the year of this date 25 26 27 public int getYear) return this.year: 28 29* Getter for the nonth of this date * @return the year of this date * @return the month of this date 31 / 32 public int getMonth)f return this.month; 34 w Getter for the day of this date * @return the day of this date 36 * 37 public int getDay()f return this.day; 38 39 Creates a new date object that is nDays in the future from this current date 41 eparam nDays is a non-negative integer (the number of days from this date that the new returned date object will be created). @return a new date object that is nDays past this current date. public Date futureDatelint nDays)( 45 46 47 return null; 49* A string representation of this date * ereturn a string representation of this date as YYYMDD 51 2 e0verride 53 public String toString) 54 return String. fornat("$04d", this.year) trino.format month n 1, Col 1 Tab Size: 2 UTF-8 CRLF Java soe Find.java FindTestCase.java IGrades javaGradesTestcase javali FutureDateTestCasejava x : TestFutureDate.java . . TestGrades.java d? Date java 1 package comp1486a3; 3 public class FutureDateTestCasef Date now; int daysInFuture; Date expected; public Date getNowt) return this.now; h public Date getExpected)f return this.expected; /*A test case for both the futureDate method 10 public int getDays( return this.daysInFuture; ) 13 14 15 16 17 18 19 2e 21 @paran target is the target sequence It is an array of one or more integers " @paran array is an array of zero or more integers * @paran expectedFind is the expected output of Find. LocateSequence target, array) *@paran expectedFindAgain is the expected output of Find. LocateAllsequenceLocations (target.array) 23 24 25 26 27 28 29 3e public FutureDateTestCase(Date now, int daysInFuture, Date expected this now this.daysInFuture-daysInFuture; this.expected expected; = now; ni, Coll Tab Sze: 4 UTF-8 CRLF Java Find.java package comp1486a3; Date java FindTestCase.java Grades java GradesTestCase.java FutureDateTestCasejava TestFutureDate javaTestGrades.java m 3 public class TestFutureDate Generate black-box test cases for the futureDate nethod (in the Date class) @return an array of test cases for the futureDate method (in the Date class). public static FutureDateTestCasell makeTestcases) 1e return null: 12 13 n 13, Col 2 Tab Size: 4 UTF-8 CRLF Java e
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