Program plan:
The variables used in the program are given below:
- item: SalesItem - an instance of the SalesItem class, which represents a sales item being sold on a website or in a store.
- comment1: Comment - an instance of the Comment class, which represents a comment left by a user about the sales item.
- comment2: Comment - another instance of the Comment class, representing a second comment about the sales item.
- comment3: Comment - a third instance of the Comment class, representing a third comment about the sales item.
The methods used in the program are as follows:
- addComment(comment: Comment): void - a method of the SalesItem class that adds a new Comment object to the item's list of comments.
- getComments(): List
- a method of the SalesItem class that returns a list of all Comment objects that have been added to the item. - assertEquals(expected: int, actual: int): void - a method of the org.junit.Assert class that checks if two integer values are equal, and throws an assertion error if they are not.
- assertTrue(condition: boolean): void - a method of the org.junit.Assert class that checks if a given boolean condition is true, and throws an assertion error if it is not.
- testAddNullComment(): a unit test method that tests the behavior of the SalesItem class when attempting to add a null comment to an item. Expects an IllegalArgumentException to be thrown.
Program Description:
The given code is a unit test written in JUnit framework for the addComment() method of the SalesItem class. It creates a new SalesItem object with a name and description and then adds three comments to it using addComment() method. The test then checks that the comments were added successfully by verifying that the size of the SalesItem's comments list is 3 and that each of the three comments is contained in the list. This is an important test to ensure that comments can be successfully added to a SalesItem object, which is a critical feature of the class for user interaction and feedback.
Want to see the full answer?
Check out a sample textbook solutionChapter 9 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- (use R language)Scatter plot(a). Run the R code example, and look at the help file for plot() function. Try different values for arguments:type, pch, lty, lwd, col(b). Use par(mfrow=c(3,2)) and output 6 plots with different argument settings.arrow_forward1. Draw flow charts for each of the following;a) A system that reads three numbers and prints the value of the largest number.b) A system reads an employee name (NAME), overtime hours worked (OVERTIME), hours absent(ABSENT) and determines the bonus payment (PAYMENT).arrow_forwardScenario You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement. You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds. The conversions are as follows: 1 kilogram = 35.274 ounces 1 kilogram = 2.20462 pounds 1 pound = 0.453592 kilograms 1 pound = 16 ounces 1 ounce = 0.0283 kilograms 1 ounce = 0.0625 pounds For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you…arrow_forward
- make a screen capture showing the StegExpose resultsarrow_forwardWhich of the following is not one of the recommended criteria for strategic objectives? Multiple Choice a) realistic b) appropriate c) sustainable d) measurablearrow_forwardManagement innovations such as total quality, benchmarking, and business process reengineering always lead to sustainable competitive advantage because everyone else is doing them. a) True b) Falsearrow_forward
- Vision statements are more specific than strategic objectives. a) True b) Falsearrow_forwardThe three components of the __________ approach to corporate accounting include financial, environmental, and social performance measures. Multiple Choice a) stakeholder b) triple dimension c) triple bottom line d) triple efficiencyarrow_forwardCompetitors, as internal stakeholders, should be included in the stakeholder management consideration of a company and in its mission statement. a) True b) Falsearrow_forward
- At what level in the organization should the strategic management perspective be emphasized? Multiple Choice a) throughout the organization b) from the bottom up in an organization c) at the top of the organization d) at the middle of the organizationarrow_forwardA good manager can be flexible when it comes to sticking to the original plan; to get good results, the intended strategy has to become the realized strategy. a) True b) Falsearrow_forward________ tend to be quite enduring and seldom change. Multiple Choice a) Strategic objectives b) Vision statements c) Strategic plans d) Mission statementsarrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning