Question
Im confused on how to ttest for my bag size. The setup needs to be let intentionally blank. I am following the UML diagram but
Im confused on how to ttest for my bag size. The setup needs to be let intentionally blank. I am following the UML diagram but lost on what they mean by putting in a Display Collection Class inside of our testBagSize() method, how to implement the getCurrentSize() method for our Bag, and where to put in the assertTrue method.
UML Diagram:
Test your bags size
1.) In your testBagSize() method, you need to create an instance of the DisplayCollection class. You can callgetItemBag() to get a reference to your DisplayCollection's bag, and store that in a local variable.
2.) Now that we have our bag, we need to check that its size is between 5 and 15. Call the getCurrentSize() method of the Bag class to get its size, and test that this number is between 5 and 15. This means that size 5, and size 15, are legal, but sizes 4 and 16 are not.
3.) To test whether an Integer value like size is greater or less than some value, you can use the assertTrue(boolean condition) method. This method takes one parameter, and checks that it is true. To give this method a boolean parameter, you can use size
CODE
/** * */ package project1;
import student.TestCase; /** * @author User1 * */ public class DisplayCollectionTest extends TestCase { /** * Setup left intentionally blank */ public void setup() { } public void testBagContents() { } public void testBagSize() { DisplayCollection.newInstance(); { Error:Method NewInstance is undefined } public int getCurrentSize(); { Error: getCurrentSize is undefined for the Display Collection Test } }
}
> Display Collection Test project 1 DisplayCollection Test() setUp():void testBag Contents():void o testBag Size():void > Display Collection Test project 1 DisplayCollection Test() setUp():void testBag Contents():void o testBag Size():voidStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started