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
Capsim Team PowerPoint Presentations - Slide Title: Key LearningsWhat were the key learnings that you discovered as a team through your Capsim simulation?
Write the SQL code that permits to implement the tables: Student and Transcript. NB: Add the constraints on the attributes – keys and other.
Draw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT