USe ASM 9.8 with Java 25
This commit is contained in:
9
pom.xml
9
pom.xml
@@ -240,6 +240,15 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
<configuration>
|
||||
<!-- Enable ByteBuddy experimental mode for Java 25 support -->
|
||||
<!-- Mockito requires this for Java 24+ -->
|
||||
<argLine>
|
||||
-Dnet.bytebuddy.experimental=true
|
||||
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||
--add-opens java.base/java.util=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -352,7 +352,7 @@ public class DatabaseService {
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// Table might not exist in scraper format - that's ok
|
||||
Console.println("ℹ️ Scraper auction table not found or incompatible schema");
|
||||
IO.println("ℹ️ Scraper auction table not found or incompatible schema");
|
||||
}
|
||||
|
||||
return imported;
|
||||
|
||||
@@ -44,7 +44,13 @@ class ImageProcessingService {
|
||||
var dir = baseDir.resolve(String.valueOf(saleId)).resolve(String.valueOf(lotId));
|
||||
Files.createDirectories(dir);
|
||||
|
||||
var fileName = Paths.get(imageUrl).getFileName().toString();
|
||||
// Extract filename from URL
|
||||
var fileName = imageUrl.substring(imageUrl.lastIndexOf('/') + 1);
|
||||
// Remove query parameters if present
|
||||
int queryIndex = fileName.indexOf('?');
|
||||
if (queryIndex > 0) {
|
||||
fileName = fileName.substring(0, queryIndex);
|
||||
}
|
||||
var dest = dir.resolve(fileName);
|
||||
|
||||
Files.write(dest, response.body());
|
||||
|
||||
@@ -70,9 +70,13 @@ class ImageProcessingServiceTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("Should handle image download failure gracefully")
|
||||
void testDownloadImageFailure() {
|
||||
// Invalid URL should return null
|
||||
String result = service.downloadImage("invalid-url", 123, 456);
|
||||
void testDownloadImageFailure() throws Exception {
|
||||
// Mock HTTP client to throw exception
|
||||
when(mockHttpClient.sendGetBytes(anyString()))
|
||||
.thenThrow(new java.io.IOException("Connection failed"));
|
||||
|
||||
// Should return null on failure
|
||||
String result = service.downloadImage("http://example.com/image.jpg", 123, 456);
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
@@ -164,7 +168,14 @@ class ImageProcessingServiceTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("Should handle database errors during image save")
|
||||
void testDatabaseErrorHandling() throws SQLException {
|
||||
void testDatabaseErrorHandling() throws Exception {
|
||||
// Mock successful HTTP download
|
||||
@SuppressWarnings("unchecked")
|
||||
var mockResponse = mock(java.net.http.HttpResponse.class);
|
||||
when(mockResponse.statusCode()).thenReturn(200);
|
||||
when(mockResponse.body()).thenReturn(new byte[]{1, 2, 3});
|
||||
when(mockHttpClient.sendGetBytes(anyString())).thenReturn(mockResponse);
|
||||
|
||||
when(mockDetector.detectObjects(anyString()))
|
||||
.thenReturn(List.of("object"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user