Skip to content

Commit 968d2fd

Browse files
committed
Fix: reverts Order.Java file and updates EccomerceSystem file for productId and orderId message
1 parent 93741f3 commit 968d2fd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/ecommerce/EcommerceSystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void addProduct(String productId, String name) {
2020
public String placeOrder(String productId, int quantity) throws ProductNotFoundException {
2121
Product product = products.get(productId);
2222
if (product == null) {
23-
throw new ProductNotFoundException("Product with ID 1 not found");
23+
throw new ProductNotFoundException("Product with ID " + productId + " not found");
2424
}
2525
String orderId = UUID.randomUUID().toString();
2626
orders.put(orderId, new Order(orderId, product, quantity));
@@ -34,7 +34,7 @@ public void cancelOrder(String orderId) {
3434
public String checkOrderStatus(String orderId) throws OrderNotFoundException {
3535
Order order = orders.get(orderId);
3636
if (order == null) {
37-
throw new OrderNotFoundException("Order with ID 1 not found");
37+
throw new OrderNotFoundException("Order with ID " + orderId + " not found");
3838
}
3939
return "Order ID: "
4040
+ orderId

lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/ecommerce/Order.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public Order(String orderId, Product product, int quantity) {
1111
this.quantity = quantity;
1212
}
1313

14-
public String getOrderId() throws OrderNotFoundException {
14+
public String getOrderId() {
1515
return orderId;
1616
}
1717

18-
public Product getProduct() throws OrderNotFoundException {
18+
public Product getProduct() {
1919
return product;
2020
}
2121

22-
public int getQuantity() throws OrderNotFoundException {
22+
public int getQuantity() {
2323
return quantity;
2424
}
2525
}

0 commit comments

Comments
 (0)