You will continue to add functionality to your existing project from the previous task. There is
no new repository to clone.
Note: You can see feedback in Autolab for your tests without completing the programming portion of
this task, but you must at least create the classes and methods that you test. You can "stub out"
these methods by having them always return a fixed value, but they must exist so the grading code
will compile and run.
Write tests in the tests.TestClasses1 class for the following functionality:
- ratings.Song - In the ratings package, test a class named Song
This class will have a constructor that takes 3 parameters in this order:
- A String representing the title of the Song
- A String representing the artist of the Song
- A String representing the Songs ID
Song will have getter and setter methods for the three constructor parameters named:
- getSongID <-- Note that both characters in ID are capital
For this task, you don't need to implement any additional methods in the Song class
(We will add to this class in later tasks)
- ratings.Rating - In the ratings package, Test a class named Rating
This class will have a constructor that takes 2 parameters in this order:
- A String representing the ID of the reviewer who gave the rating
- An int representing the rating that the reviewer gave
Rating will have getter and setter methods for the two constructor parameters named:
Ratings must be in the range 1-5. If someone calls setRatings with an invalid rating,
the rating should be set to -1 to indicate that an error has occurred.
(eg. setRating(100) should result in the rating being set to -1). This check must also
apply when the constructor is called with an invalid rating.
- ratings.Reviewer - In the ratings package, Test a class named Reviewer
This class will have a constructor that takes 1 parameter:
- A String representing the ID of the reviewer
Reviewer will have getter and setter methods for the constructor parameter named:
Implement a method named rateSong that takes an int as a parameter and returns a
reference to a new Rating object (Using the Rating class described above) with this
reviewer's ID and the rating from the parameter of this method.
Implement the Song, Rating, and Reviewer classes with all of the functionality you've tested above.
The feedback in AutoLab will be given in 3 phases. If you don't complete a phase, then feedback for
the following phase(s) will not be given.
- Running your tests on a Correct Solution
- Running your tests on several Incorrect Solutions
- Running my tests on Your Solution
Once you complete all 3 phases, you will have completed this Task and AutoLab will confirm this
with a score of 1.0 for complete.