Skip to content

Commit 30c0926

Browse files
author
“Tezz03”
committed
fix: lesson_14_debug
1 parent b6be51b commit 30c0926

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void addProduct(String productId, String name) {
1919

2020
public String placeOrder(String productId, int quantity) throws ProductNotFoundException {
2121
Product product = products.get(productId);
22-
if( product == null) {
22+
if (product == null) {
2323
throw new ProductNotFoundException("Product with ID " + productId + " not found");
2424
}
2525
String orderId = UUID.randomUUID().toString();
@@ -29,15 +29,15 @@ public String placeOrder(String productId, int quantity) throws ProductNotFoundE
2929

3030
public void cancelOrder(String orderId) throws OrderNotFoundException {
3131
orders.remove(orderId);
32-
if( orders == null) {
33-
throw new OrderNotFoundException( "Order with ID " + orderId + " not found");
32+
if (orders == null) {
33+
throw new OrderNotFoundException("Order with ID " + orderId + " not found");
3434
}
3535
}
3636

37-
public String checkOrderStatus(String orderId) throws OrderNotFoundException{
37+
public String checkOrderStatus(String orderId) throws OrderNotFoundException {
3838
Order order = orders.get(orderId);
39-
if ( order == null) {
40-
throw new OrderNotFoundException( "Order with ID " + orderId + " not found");
39+
if (order == null) {
40+
throw new OrderNotFoundException("Order with ID " + orderId + " not found");
4141
}
4242
return "Order ID: "
4343
+ orderId

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
package com.codedifferently.lesson14.ecommerce;
77

8-
public class OrderNotFoundException extends Exception{
9-
public OrderNotFoundException(String message) {
8+
public class OrderNotFoundException extends Exception {
9+
public OrderNotFoundException(String message) {
1010
super(message);
11-
}
12-
}
11+
}
12+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
package com.codedifferently.lesson14.ecommerce;
77

8-
public class ProductNotFoundException extends Exception{
9-
public ProductNotFoundException(String message) {
10-
super(message);
11-
}
8+
public class ProductNotFoundException extends Exception {
9+
public ProductNotFoundException(String message) {
10+
super(message);
11+
}
1212
}

0 commit comments

Comments
 (0)