Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please in java To help you write your tests, you will write several testing utility methods. These methods are meant to help you write your
Please in java To help you write your tests, you will write several testing utility methods. These methods are meant to help you write your unit tests. These methods will compare Song, Rating, and Reviewer objects for equality. When writing test cases, you should create an object with the values that you expect, call the method to be tested to create an object of the same type, then call your utility method to check if the objects contain all the same values. Create a class named TestClasses in the tests package testsTestClasses and write the following methods in that class Note: Do not add the @Test annotation to these methods since they are not tests: compareSongs Write a method named compareSongs in the tests.TestClasses class that: Takes references to Song objects as parameters Returns a boolean that is true if the title, artist, and id of both Songs are exactly the same. The method either returns false, or fails a JUnit assert, if the Songs do not have all the same values If the Songs do not have all the same values you can either: return false, or have an assert that fails. This gives you the option of using assertTrue, assertEquals, etc. in your utility methods instead of returning false when the test should fail. It is recommended that you write this method with assert statements, then add "return true" as the last line of the method. The method will never return false, but if any assert fails the test will fail without reaching your "return true" line. If you chose to not use asserts and instead return false when the Songs are not identical, be sure to add assertTrue in your test cases when you call this method. This structure is the same for all utility methods compareRatings Write a method named compareRatings in the tests.TestClasses class that Takes references to Rating objects Returns a boolean that is true if the rating and reviewerID of both Ratings are exactly the same. The method either returns false, or fails a JUnit assert, if the Ratings do not have all the same values compareReviewers Write a method named compareReviewers in the tests.TestClasses class that Takes references to Reviewer objects Returns a boolean that is true if the reviewerID of both Reviewers are exactly the same. The method either returns false, or fails a JUnit assert, if the Reviewers do not have the same reviewerID To help you write your tests, you will write several testing utility methods. These methods are meant to help you write your unit tests. These methods will compare Song, Rating, and Reviewer objects for equality. When writing test cases, you should create an object with the values that you expect, call the method to be tested to create an object of the same type, then call your utility method to check if the objects contain all the same values. Create a class named TestClasses in the tests package testsTestClasses and write the following methods in that class Note: Do not add the @Test annotation to these methods since they are not tests: compareSongs Write a method named compareSongs in the tests.TestClasses class that: Takes references to Song objects as parameters Returns a boolean that is true if the title, artist, and id of both Songs are exactly the same. The method either returns false, or fails a JUnit assert, if the Songs do not have all the same values If the Songs do not have all the same values you can either: return false, or have an assert that fails. This gives you the option of using assertTrue, assertEquals, etc. in your utility methods instead of returning false when the test should fail. It is recommended that you write this method with assert statements, then add "return true" as the last line of the method. The method will never return false, but if any assert fails the test will fail without reaching your "return true" line. If you chose to not use asserts and instead return false when the Songs are not identical, be sure to add assertTrue in your test cases when you call this method. This structure is the same for all utility methods compareRatings Write a method named compareRatings in the tests.TestClasses class that Takes references to Rating objects Returns a boolean that is true if the rating and reviewerID of both Ratings are exactly the same. The method either returns false, or fails a JUnit assert, if the Ratings do not have all the same values compareReviewers Write a method named compareReviewers in the tests.TestClasses class that Takes references to Reviewer objects Returns a boolean that is true if the reviewerID of both Reviewers are exactly the same. The method either returns false, or fails a JUnit assert, if the Reviewers do not have the same reviewerID
Please in java
To help you write your tests, you will write several testing utility methods. These methods are meant to help you write your
unit tests. These methods will compare Song, Rating, and Reviewer objects for equality. When writing test cases, you should
create an object with the values that you expect, call the method to be tested to create an object of the same type, then call
your utility method to check if the objects contain all the same values.
Create a class named TestClasses in the tests package testsTestClasses and write the following methods in that class
Note: Do not add the @Test annotation to these methods since they are not tests:
compareSongs Write a method named compareSongs in the tests.TestClasses class that:
Takes references to Song objects as parameters
Returns a boolean that is true if the title, artist, and id of both Songs are exactly the same. The method either
returns false, or fails a JUnit assert, if the Songs do not have all the same values
If the Songs do not have all the same values you can either: return false, or have an assert that fails. This gives
you the option of using assertTrue, assertEquals, etc. in your utility methods instead of returning false when the
test should fail. It is recommended that you write this method with assert statements, then add "return true" as
the last line of the method. The method will never return false, but if any assert fails the test will fail without
reaching your "return true" line. If you chose to not use asserts and instead return false when the Songs are not
identical, be sure to add assertTrue in your test cases when you call this method. This structure is the same for
all utility methods
compareRatings Write a method named compareRatings in the tests.TestClasses class that
Takes references to Rating objects
Returns a boolean that is true if the rating and reviewerID of both Ratings are exactly the same. The method
either returns false, or fails a JUnit assert, if the Ratings do not have all the same values
compareReviewers Write a method named compareReviewers in the tests.TestClasses class that
Takes references to Reviewer objects
Returns a boolean that is true if the reviewerID of both Reviewers are exactly the same. The method either
returns false, or fails a JUnit assert, if the Reviewers do not have the same reviewerID
To help you write your tests, you will write several testing utility methods. These methods are meant to help you write your unit tests. These methods will compare Song, Rating, and Reviewer objects for equality. When writing test cases, you should create an object with the values that you expect, call the method to be tested to create an object of the same type, then call your utility method to check if the objects contain all the same values.
Create a class named TestClasses in the tests package testsTestClasses and write the following methods in that class Note: Do not add the @Test annotation to these methods since they are not tests:
compareSongs Write a method named compareSongs in the tests.TestClasses class that:
Takes references to Song objects as parameters
Returns a boolean that is true if the title, artist, and id of both Songs are exactly the same. The method either returns false, or fails a JUnit assert, if the Songs do not have all the same values
If the Songs do not have all the same values you can either: return false, or have an assert that fails. This gives you the option of using assertTrue, assertEquals, etc. in your utility methods instead of returning false when the test should fail. It is recommended that you write this method with assert statements, then add "return true" as the last line of the method. The method will never return false, but if any assert fails the test will fail without reaching your "return true" line. If you chose to not use asserts and instead return false when the Songs are not identical, be sure to add assertTrue in your test cases when you call this method. This structure is the same for all utility methods
compareRatings Write a method named compareRatings in the tests.TestClasses class that
Takes references to Rating objects
Returns a boolean that is true if the rating and reviewerID of both Ratings are exactly the same. The method either returns false, or fails a JUnit assert, if the Ratings do not have all the same values
compareReviewers Write a method named compareReviewers in the tests.TestClasses class that
Takes references to Reviewer objects
Returns a boolean that is true if the reviewerID of both Reviewers are exactly the same. The method either returns false, or fails a JUnit assert, if the Reviewers do not have the same reviewerID
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