From 63f7dd42926bad43e16a5e5bc34090c73338f4c1 Mon Sep 17 00:00:00 2001 From: Yuvalm008 Date: Tue, 1 Jul 2025 09:48:08 +0300 Subject: [PATCH 1/2] fixed auction issue --- .../ApplicationLayer/restControllers/UserRestController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TradingSystem/src/main/java/com/TradingSystem/TradingSystem/ApplicationLayer/restControllers/UserRestController.java b/TradingSystem/src/main/java/com/TradingSystem/TradingSystem/ApplicationLayer/restControllers/UserRestController.java index 5ce33388..14408b06 100644 --- a/TradingSystem/src/main/java/com/TradingSystem/TradingSystem/ApplicationLayer/restControllers/UserRestController.java +++ b/TradingSystem/src/main/java/com/TradingSystem/TradingSystem/ApplicationLayer/restControllers/UserRestController.java @@ -1912,7 +1912,6 @@ public ResponseEntity placeAuctionBid( return ResponseEntity.status(HttpStatus.UNAUTHORIZED) .body("You are suspended and cannot place a bid"); } - member.addPurchaseToWishlist(storeService.getAuctionByProductId(storeId, productId)); // productId -> // purchase String previousBidder = storeService.placeBidForAuction(storeId, productId, member.getEmail(), bidAmount); if (previousBidder != null) { @@ -1928,6 +1927,10 @@ public ResponseEntity placeAuctionBid( String.format("You have been outbid. New highest bid is %.2f", bidAmount), storeId); log.info("Previous bidder {} notified of new bid", previousBidder); } + else{ + member.addPurchaseToWishlist(storeService.getAuctionByProductId(storeId, productId)); // productId -> + + } return ResponseEntity.ok("Bid placed successfully"); } catch (Exception e) { From 7dfe5270bf3013b76611edc3f7c99395755db34b Mon Sep 17 00:00:00 2001 From: Yuvalm008 Date: Tue, 1 Jul 2025 09:54:12 +0300 Subject: [PATCH 2/2] fixed auction test --- .../TradingSystem/BlackBoxTests/AuctionBlackBoxTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TradingSystem/src/test/java/com/TradingSystem/TradingSystem/BlackBoxTests/AuctionBlackBoxTests.java b/TradingSystem/src/test/java/com/TradingSystem/TradingSystem/BlackBoxTests/AuctionBlackBoxTests.java index 5fda59bd..0231e949 100644 --- a/TradingSystem/src/test/java/com/TradingSystem/TradingSystem/BlackBoxTests/AuctionBlackBoxTests.java +++ b/TradingSystem/src/test/java/com/TradingSystem/TradingSystem/BlackBoxTests/AuctionBlackBoxTests.java @@ -170,7 +170,7 @@ void GivenInvalidProductId_WhenPlacingAuctionBid_ThenBidFails() throws Exception .param("productId", "nonexistent-product") .param("bidAmount", "120.0")) .andExpect(status().isInternalServerError()) - .andExpect(content().string(containsString("Auction not found here"))); + .andExpect(content().string(containsString("Auction does not exist"))); } // @Test