In this guided project, you'll develop functional requirements and test cases for a Lunch Ordering Service application. This service allows employees to order lunch from partner restaurants for delivery to their workplace. You'll practice writing clear, testable requirements and comprehensive test cases to verify the application's behavior.
A tech company wants to streamline lunch ordering for its employees. They're partnering with local restaurants to offer a variety of food options delivered to the office. The application needs to handle ordering, payment processing, delivery scheduling, and special dietary requirements.
The application must allow users to:
Primary Actor: Employee
Preconditions:
Steps:
Postconditions:
Alternative Flows:
Primary Actor: Employee
Preconditions:
Steps:
Postconditions:
Primary Actor: Employee
Preconditions:
Steps:
Postconditions:
Alternative Flows:
Test Case ID: TC001
Description: Verify that a user can successfully place a lunch order
Related Use Case: UC001
Preconditions:
Test Steps:
Expected Results:
Test Case ID: TC002
Description: Verify that menu items can be filtered by dietary restrictions
Related Use Case: UC002
Preconditions:
Test Steps:
Expected Results:
Test Case ID: TC003
Description: Verify that orders can be cancelled when more than 1 hour before delivery
Related Use Case: UC003
Preconditions:
Test Steps:
Expected Results:
Test Case ID: TC004
Description: Verify that orders cannot be cancelled when less than 1 hour before delivery
Related Use Case: UC003
Preconditions:
Test Steps:
Expected Results:
public class LunchOrder { private String orderId; private User customer; private Restaurant restaurant; private List<MenuItem> items; private LocalDateTime deliveryTime; private OrderStatus status; private PaymentMethod paymentMethod; private double totalAmount; // Constructor, getters, setters public boolean isEligibleForCancellation() { LocalDateTime now = LocalDateTime.now(); return now.plusHours(1).isBefore(deliveryTime); } public void cancel() throws OrderException { if (!isEligibleForCancellation()) { throw new OrderException("Orders can only be cancelled at least 1 hour before delivery"); } this.status = OrderStatus.CANCELLED; // Process refund logic } public void addCustomization(MenuItem item, String customization) { // Add customization to menu item } // Other methods for order processing }