Fix mock tests

Former-commit-id: ff8f5f2c1a
This commit is contained in:
Tour
2025-12-04 20:14:28 +01:00
parent 4ceb284ab7
commit 2ff7aa6027
7 changed files with 408 additions and 366 deletions

View File

@@ -47,8 +47,8 @@ class IntegrationTest {
"non_existent.weights",
"non_existent.txt"
);
RateLimitedHttpClient httpClient = new RateLimitedHttpClient();
var httpClient = new RateLimitedHttpClient();
imageProcessor = new ImageProcessingService(db, detector, httpClient);
monitor = new TroostwijkMonitor(
@@ -170,8 +170,8 @@ class IntegrationTest {
db.updateLotCurrentBid(updatedLot);
// Send notification
String message = String.format("Nieuw bod op kavel %d: €%.2f (was €%.2f)",
lot.lotId(), 2000.00, 1500.00);
var message = String.format("Nieuw bod op kavel %d: €%.2f (was €%.2f)",
lot.lotId(), 2000.00, 1500.00);
assertDoesNotThrow(() ->
notifier.sendNotification(message, "Kavel bieding update", 0)
@@ -212,7 +212,7 @@ class IntegrationTest {
assertTrue(closingSoon.minutesUntilClose() < 5);
// Send high-priority notification
String message = "Kavel " + closingSoon.lotId() + " sluit binnen 5 min.";
var message = "Kavel " + closingSoon.lotId() + " sluit binnen 5 min.";
assertDoesNotThrow(() ->
notifier.sendNotification(message, "Lot nearing closure", 1)
);
@@ -281,7 +281,7 @@ class IntegrationTest {
assertDoesNotThrow(() -> monitor.processPendingImages());
// Verify database integrity
int imageCount = db.getImageCount();
var imageCount = db.getImageCount();
assertTrue(imageCount >= 0);
}
@@ -348,11 +348,11 @@ class IntegrationTest {
assertTrue(allLabels.contains("excavator") || allLabels.contains("machinery"));
// Simulate value estimation notification
String message = String.format(
var message = String.format(
"Lot contains: %s\nEstimated value: €%,.2f",
String.join(", ", allLabels),
lot.currentBid()
);
);
assertDoesNotThrow(() ->
notifier.sendNotification(message, "Object Detected", 0)
@@ -363,9 +363,9 @@ class IntegrationTest {
@Order(9)
@DisplayName("Integration: Handle rapid concurrent updates")
void testConcurrentOperations() throws InterruptedException, SQLException {
Thread auctionThread = new Thread(() -> {
var auctionThread = new Thread(() -> {
try {
for (int i = 0; i < 10; i++) {
for (var i = 0; i < 10; i++) {
db.upsertAuction(new AuctionInfo(
60000 + i, "Concurrent Auction " + i, "Test, NL", "Test", "NL",
"https://example.com/60" + i, "A1", 5, null
@@ -375,10 +375,10 @@ class IntegrationTest {
fail("Auction thread failed: " + e.getMessage());
}
});
Thread lotThread = new Thread(() -> {
var lotThread = new Thread(() -> {
try {
for (int i = 0; i < 10; i++) {
for (var i = 0; i < 10; i++) {
db.upsertLot(new Lot(
60000 + i, 70000 + i, "Concurrent Lot " + i, "Desc", "", "", 0, "Cat",
100.0 * i, "EUR", "https://example.com/70" + i, null, false
@@ -397,14 +397,14 @@ class IntegrationTest {
// Verify all were inserted
var auctions = db.getAllAuctions();
var lots = db.getAllLots();
long auctionCount = auctions.stream()
.filter(a -> a.auctionId() >= 60000 && a.auctionId() < 60010)
.count();
long lotCount = lots.stream()
.filter(l -> l.lotId() >= 70000 && l.lotId() < 70010)
.count();
var auctionCount = auctions.stream()
.filter(a -> a.auctionId() >= 60000 && a.auctionId() < 60010)
.count();
var lotCount = lots.stream()
.filter(l -> l.lotId() >= 70000 && l.lotId() < 70010)
.count();
assertEquals(10, auctionCount);
assertEquals(10, lotCount);