Skip to content

Commit 878e8f4

Browse files
committed
Feat: Adds Shawn Dunsmore Jr Lesson14 Fix SpotlessApply
1 parent 0c86c2a commit 878e8f4

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ 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){
23-
throw new ProductNotFoundException("Product with ID "+ productId +" not found");
22+
if (product == null) {
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));
2727
return orderId;
2828
}
2929

30-
public void cancelOrder(String orderId){
30+
public void cancelOrder(String orderId) {
3131
orders.remove(orderId);
3232
}
3333

3434
public String checkOrderStatus(String orderId) throws OrderNotFoundException {
3535
Order order = orders.get(orderId);
36-
if (order == null){
37-
throw new OrderNotFoundException("Order with ID "+ orderId+ " not found");
36+
if (order == null) {
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/OrderNotFoundException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package com.codedifferently.lesson14.ecommerce;
77

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package com.codedifferently.lesson14.ecommerce;
77

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

lesson_14/exceptions/exceptions_app/src/test/java/com/codedifferently/lesson14/ecommerce/EcommerceSystemTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.assertj.core.api.Assertions.assertThat;
44
import static org.assertj.core.api.Assertions.assertThatThrownBy;
5+
56
import org.junit.jupiter.api.BeforeEach;
67
import org.junit.jupiter.api.Test;
78

0 commit comments

Comments
 (0)