all
This commit is contained in:
BIN
empty_test_1765183292551.db
Normal file
BIN
empty_test_1765183292551.db
Normal file
Binary file not shown.
@@ -132,14 +132,7 @@ public class AuctionRepository {
|
||||
.bind("country", countryCode)
|
||||
.map((rs, ctx) -> {
|
||||
var closingStr = rs.getString("closing_time");
|
||||
LocalDateTime closingTime = null;
|
||||
if (closingStr != null && !closingStr.isBlank()) {
|
||||
try {
|
||||
closingTime = LocalDateTime.parse(closingStr);
|
||||
} catch (Exception e) {
|
||||
log.warn("Invalid closing_time format: {}", closingStr);
|
||||
}
|
||||
}
|
||||
LocalDateTime closingTime = auctiora.ScraperDataAdapter.parseTimestamp(closingStr);
|
||||
|
||||
return new AuctionInfo(
|
||||
rs.getLong("auction_id"),
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -6,6 +6,8 @@ import org.junit.jupiter.api.DisplayName;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
@@ -228,6 +230,24 @@ class ScraperDataAdapterTest {
|
||||
assertEquals("GBP", lot.currency());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Should parse epoch seconds timestamp")
|
||||
void testParseEpochSeconds() {
|
||||
long seconds = 1765994400L;
|
||||
LocalDateTime expected = LocalDateTime.ofInstant(Instant.ofEpochSecond(seconds), ZoneId.systemDefault());
|
||||
LocalDateTime parsed = ScraperDataAdapter.parseTimestamp(String.valueOf(seconds));
|
||||
assertEquals(expected, parsed);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Should parse epoch milliseconds timestamp")
|
||||
void testParseEpochMillis() {
|
||||
long millis = 1765994400000L;
|
||||
LocalDateTime expected = LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault());
|
||||
LocalDateTime parsed = ScraperDataAdapter.parseTimestamp(String.valueOf(millis));
|
||||
assertEquals(expected, parsed);
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
private ResultSet createLotResultSet(String bidAmount) throws SQLException {
|
||||
|
||||
Reference in New Issue
Block a user