Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

n this exercise, you will write a set of JUnit test cases for a class called Balloon that models a simple toy balloon. See the

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

n this exercise, you will write a set of JUnit test cases for a class called Balloon that models a simple toy balloon. See the javadoc for the Balloon class here. There are 5 rersions of this class for you to try your tests on. Your task is to write a comprehensive set of unit test cases that enables you to identify what is wrong in the buggy versions, without seeing the source code. (This is sometimes called "black-box" style testing, since we can't see inside the implementation.) Write a set of unit test cases for Balloon. Each test case should focus on checking one simple fact about the behavior of the class. For example you might start by making a list of statements such as A newly constructed Balloon should have radius zero. A newly constructed Balloon should not be popped. After calling blow(5) on a Balloon with maximum radius 10 , the radius should be 5. Study the javadoc and write down some more facts that you might want to verify. Each of these facts becomes a test case. Write enough test cases that you would be comfortable spending your own hard-earned money on one of these alloon objects, confident that it will work correctly. public class Balloon extends java. 1 ang. Object sopped, the blow[ method has no effect. Constructor Summary Constructor and Description Balloon (int max) Method Summary public Balloon(int max) Creates a balloon with given maximum radius, but if the given argument is negative the balloon will have maximum radius o; initially, the balloon is deflated (radius is zero) and is not popped. Parameters: max - Maximum radius of the balloon Wethod Detail blow public void blow(int amount) Parameters: amount - Amount by which radius is be increased public int getradius() Returns the current radius of this bulloon. Returne: the radius of the balloon IsPopped public boolean iapopped(? Determines whether this balloon is popped. Returns: true if the balloon is popped, false otherwise deflate public void deflate( ) Deflates the balloon without popping it (a deflated balloon has radius zero). pop public void pop(] Pops the balloon (a popped balloon has radius zero)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions