Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
Question
Book Icon
Chapter 9, Problem 16E
Program Plan Intro

Program plan:

The variables used in the program are given below:

  1. salesItem: An instance of the SalesItem class that is used to perform tests on the addComment() method.

The methods used in the program are as follows:

  1. testNegativeRatingBoundaries(): A JUnit test method that tests the addComment() method with illegal ratings of 0 and 6, which should return false.
  2. assertFalse(): A JUnit assertion method that checks whether the passed boolean expression is false or not. In this case, it is used to check whether the addComment() method returns false when trying to add comments with illegal ratings.
  3. addComment(): A method of the SalesItem class that adds a comment to the salesItem instance with a given author, comment, and rating. This method returns true if the comment is added successfully and false if the rating is invalid.

Program Description:

To write a test to perform negative testing on the boundaries of the rating range.

Blurred answer
Students have asked these similar questions
It implies testing in a "BLACK Box." What different variants exist on this theme?
THIS DOESNT WORK WITH THE TEST CLASS PROVIDED, PLEASE ENSURE THAT IT DOES!
In this second exercise, we are going to look at the iIn this exercise, you are going to complete the Rectangle class. You need to complete the class so that you can print and compare two rectangles. Once complete, use the RectangleTester to test the results. In the tester class, you are given 3 rectangles that you should print and compare. Sample results are provided below. Sample output A rectangle with a width of 5 and a height of 4 A rectangle with a width of 5 and a height of 4 A rectangle with a width of 10 and a height of 4 true false public class RectangleTester{public static void main(String[] args){Rectangle rect1 = new Rectangle(5, 4);Rectangle rect2 = new Rectangle(5, 4);Rectangle rect3 = new Rectangle(10, 4);// Print all three rectangles// Print one true statement comparing rectangles// Print one false statment comparing rectangles}}   public class Rectangle{ private int width;private int height;public Rectangle(int width, int height) {}}
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education