@@ -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 }
0 commit comments