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 13E
Program Plan Intro

Program plan:

The variables used in the program are given below:

1. Comment comment is an object variable of type Comment used to create a new comment object for each test method.

2. String expected is a string variable used to hold the expected output for the testGetFullDetails() method.

The methods used in the program are as follows:

  1. testUpvote(): Tests the upvote() method of the Comment class by creating a comment object, verifying its initial vote count is 0, upvoting the comment, and verifying its vote count is now 1.
  2. testDownvote(): Tests the downvote() method of the Comment class by creating a comment object, verifying its initial vote count is 0, downvoting the comment, and verifying its vote count is now -1.
  3. testGetAuthor(): Tests the getAuthor() method of the Comment class by creating a comment object and verifying its author name matches the expected value.
  4. testGetRating(): Tests the getRating() method of the Comment class by creating a comment object and verifying its rating matches the expected value.
  5. testGetFullDetails(): Tests the getFullDetails() method of the Comment class by creating a comment object and verifying its full details (rating, author, text, and vote count) match the expected string.

Program Description:

To create a test class for the Comment class.

Blurred answer
Students have asked these similar questions
Use BlueJ’s Project Documentation function to generate documentation for your TechSupport project. Examine it. Is it accurate? Is it -complete? Which parts are useful? Which are not? Do you find any errors in the documentation?
Create a test project to play with the Comparable interface. Edit the Card class to implement Comparable . Cards are to be compared using their value. They are considered the same if they have the value. One is less than the other if its value is less. Add the compareTo method that takes a Card object as a argument and returns 0 meaning the values are the same, 1 meaning the card is greater than the parameter, -1 meaning the card is less than the parameter. Create a main() that creates a Deck. Use your code from the program that dealt out Cards from a Deck and showed the hands but this time, now that Cards are comparible, show them in sorted order using Arrays.sort if the had is an array, or Collections.sort if the hand is an ArrayList. Show the hands. Document, document, document!
Please do it with comments.
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