Question: } assertTrue(box.isEmpty()); This works because a newly created Mailbox is empty. You should also create a test method that tests the return value of

} assertTrue(box.isEmpty()); This works because a newly created Mailbox is empty. Youshould also create a test method that tests the return value of

} assertTrue(box.isEmpty()); This works because a newly created Mailbox is empty. You should also create a test method that tests the return value of isEmpty when the Mailbox is NOT empty (add a message to the Mailbox and then test the return value of isEmpty). 22. To test getNextMessage, create a message with known values, add it to the mailbox, then retrieve the next message by calling getNextMessage and test that the retrieved message has the same values as the one you added. You should also test that the retrieved message was removed from the mailbox. Q: If you add one message to an empty Mailbox and then retrieve it from the Mailbox, what method should you call to make sure the message was removed? 19. Now, you are going to build a tester for the Mailbox class. Create the unit test class the same way as above. Make sure Setup is checked. 20. In the generated setup method, create an instance of your mailbox. box = new Mailbox (owner); This will cause a fresh Mailbox object to be created before each test case. The Mailbox reference should be an instance variable of the test class. 21. Now, create tests for each of the Mailbox methods. For example, to test the isEmpty method, simply call isEmpty and test that it returns true, using assertTrue. public void testIsEmpty() {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!