Skip to content

Commit a029d67

Browse files
committed
chore: runs gradle spotlessapply command to make build pass. lesson_14 -Joseph Caballero
1 parent f97cdeb commit a029d67

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ 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-
/*the reason why i put the throw here is due to the fact that the product is being declared and we know in the test cases
22+
/*the reason why i put the throw here is due to the fact that the product is being declared and we know in the test cases
2323
* that we are given a product id, what we dont know is if thaat productId is correct so technically speaking we should check
2424
* if the productId is matched up to the hashmap at all using get and if it doesnt exist then product will be null because no such key exists
25-
* instead of trying to put it in every single instance we see an order id or product id our test cases check to see if the given
26-
* input is even available for us to grab not if there is any input at all since that itself in my opinion would be front end and not us
25+
* instead of trying to put it in every single instance we see an order id or product id our test cases check to see if the given
26+
* input is even available for us to grab not if there is any input at all since that itself in my opinion would be front end and not us
2727
* that would handle that sort of thing before it reaches this point
28-
*
28+
*
2929
* If you need me to delete comments I can i just wrote this out incase people look at any pr's for their own reasoning or what not
3030
*/
3131
if (product == null) {
@@ -44,10 +44,13 @@ public String checkOrderStatus(String orderId)
4444
throws OrderNotFoundException, ProductNotFoundException {
4545

4646
Order order = orders.get(orderId);
47-
// Since order is set at this exact moment all we need to do is check if the given id is in the hashmap and if it isnt we know
48-
//that it would return a null value if no such key exists, hence why we would see if order == null and if it is throw that error
49-
//we do this instead of having an error at each exact moment because we know in the test cases we are given an orderId we just need to make sure
50-
//on our end that it is correct, not if it exists.
47+
// Since order is set at this exact moment all we need to do is check if the given id is in the
48+
// hashmap and if it isnt we know
49+
// that it would return a null value if no such key exists, hence why we would see if order ==
50+
// null and if it is throw that error
51+
// we do this instead of having an error at each exact moment because we know in the test cases
52+
// we are given an orderId we just need to make sure
53+
// on our end that it is correct, not if it exists.
5154
if (order == null) {
5255
throw new OrderNotFoundException("Order with ID " + orderId + " not found");
5356
}

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

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public String getProductId() {
1313
return productId;
1414
}
1515

16-
public String getName() {
16+
public String getName() {
1717
return name;
1818
}
1919
}

0 commit comments

Comments
 (0)