Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DiscountMethodTest class For this part of the assignment you will need to write a series of unit tests in the DiscountMethodTest class (it is located

image text in transcribed
image text in transcribed
DiscountMethodTest class For this part of the assignment you will need to write a series of unit tests in the DiscountMethodTest class (it is located in the MyUnitTests package under TestPackages) in order to black-box test a method that provides discounts for restaurant patrons. The checkIfCustomerGetsDiscount method requires two arguments, the first of type int representing the age of the customer and the second of type boolean representing whether or not the customer is/was a member of the military. The method returns a boolean value, true if a discount should be given and false otherwise. It is your jobs to create a set of unit tests to ensure that this method is working properly. You can assume that the method should follow these rules if it is functioning correctly: - Children who are 6 years old or younger should receive a discount - Adults who are 65 years or older should receive a discount - Anyone who is/was in the military should receive a discount - You must be at least 16 years old to serve in the military - Age cannot be negative, but there is no upper bound (to ficcommodate for future tech) An example unit tests has already been created for you and can be used as a template for creating the other tests. To help you determine if you have a good set of unit tests, the Restaurant class has been specifically designed to include several modes that simulate possible versions of the method you are testing. You can manually set the mode. Here are the different modes: Mode.WORKS_CORRECTLY Mode.ALWAYS TRUE Mode.ALWAYS_FALSE Mode.AGE_BOUNDARY_TOO_TIGHT Mode.AGE_BOUNDARY_TOO_LOOSE Mode.REQUIRES_MILITARY_SERVICE Mode.NO_MILITARY_AGE_RESTRICTION Mode.MILITARY_AGE_BOUNDARY_TOO_TIGHT Mode.MILITARY_AGE_BOUNDARY_TOO_LOOSE Mode.ALLOWS_ILLEGAL_AGES A set of unit tests designed to test your unit tests has also been provided. You can run the DiscountMethodTestTest file located in the Lab06 package which will evaluate whether or not your suite of unit tests can identify certain potential problems that could exist within the checkIfCustomerGetsDiscount method. When testing with Modes other than WORKS CORRECTLY, you should expect that some of your tests will fail, which is what tests should do when they test incorrect code

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

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

Define Management or What is Management?

Answered: 1 week ago