Ticket Title: Test Coffee Class Methods and Object Creation
Description:
This ticket addresses the testing of the Coffee class in the JavaGo package. It ensures that all methods in the Coffee class function as expected, particularly object instantiation and printing coffee details.
Acceptance Criteria:
A Coffee object should be created with valid attributes (name, description, price, calories, allergens, milk type, bean type).
The printCoffee method should accurately print details based on the item name.
getMilkType() and getBeanType() methods should return the correct values.
The class should handle cases where no matching coffee item exists.
Test Plan:
Test Environment Setup:
Ensure Java JDK 11+ is installed.
Run tests on an IDE with built-in JUnit testing (e.g., IntelliJ IDEA or Eclipse).
Verify the Item superclass and other dependencies are properly implemented.
Test Cases:
Test Case ID: TC-001
Description: Verify the creation of a Coffee object.
Steps to Reproduce:
Instantiate a Coffee object with the following attributes: Coffee("Espresso", "Strong espresso shot", 2.50, 50, false, "Oat Milk", "Arabica")
Assert that the attributes are correctly set, including milk type and bean type.
Expected Result: The Coffee object should store the correct values for each attribute.
Test Case ID: TC-002
Description: Validate the printCoffee method with a valid item name.
Steps to Reproduce:
Create several Coffee objects and add them to the coffees array list.
Call Coffee.printCoffee("Espresso").
Expected Result: The details of the Espresso coffee item should be printed, including milk type and bean type.
Test Case ID: TC-003
Description: Validate the printCoffee method with an invalid item name.
Steps to Reproduce:
Call Coffee.printCoffee("Mocha") when no Mocha coffee exists in the list.
Expected Result: "Coffee item not found!" should be printed to the console.
Test Case ID: TC-004
Description: Validate getMilkType() and getBeanType() methods.
Steps to Reproduce:
Create a Coffee object and call getMilkType() and getBeanType() methods.
Expected Result: The correct milk type and bean type should be returned based on the object attributes.
Post-conditions:
No data should persist between tests, and the coffees list should be empty after tests are completed.
Additional Notes:
Ensure the Item class is fully functional before testing the Coffee subclass.
Ticket Title: Test Coffee Class Methods and Object Creation
Description: This ticket addresses the testing of the
Coffee
class in theJavaGo
package. It ensures that all methods in theCoffee
class function as expected, particularly object instantiation and printing coffee details.Acceptance Criteria:
Coffee
object should be created with valid attributes (name, description, price, calories, allergens, milk type, bean type).printCoffee
method should accurately print details based on the item name.getMilkType()
andgetBeanType()
methods should return the correct values.Test Plan:
Test Environment Setup:
Item
superclass and other dependencies are properly implemented.Test Cases:
Test Case ID: TC-001
Coffee
object.Coffee
object with the following attributes:Coffee("Espresso", "Strong espresso shot", 2.50, 50, false, "Oat Milk", "Arabica")
Coffee
object should store the correct values for each attribute.Test Case ID: TC-002
printCoffee
method with a valid item name.Coffee
objects and add them to thecoffees
array list.Coffee.printCoffee("Espresso")
.Espresso
coffee item should be printed, including milk type and bean type.Test Case ID: TC-003
printCoffee
method with an invalid item name.Coffee.printCoffee("Mocha")
when noMocha
coffee exists in the list.Test Case ID: TC-004
getMilkType()
andgetBeanType()
methods.Coffee
object and callgetMilkType()
andgetBeanType()
methods.Post-conditions:
coffees
list should be empty after tests are completed.Additional Notes:
Item
class is fully functional before testing theCoffee
subclass.