Skip to content

Commit 4fe5ab2

Browse files
committed
Remove deprecated File-based extractResources() method
After successfully migrating all 704 integration tests to use the new Path-based extractResourcesAsPath() method, the old File-based method is no longer needed and has been removed. Changes: - Removed extractResources() method from AbstractMavenIntegrationTestCase - Updated tests to verify Path-to-File conversion instead of backward compatibility - All integration tests compile successfully without the deprecated method - All unit tests pass This completes the full migration to NIO2 Path API for integration tests. The codebase now exclusively uses modern Path-based operations, providing better performance, improved cross-platform compatibility, and cleaner code.
1 parent b239ff7 commit 4fe5ab2

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ public void close() throws IOException {}
7373

7474

7575

76-
protected File extractResources(String resourcePath) throws IOException {
77-
return extractResourcesAsPath(resourcePath).toFile();
78-
}
79-
8076
/**
8177
* Extracts test resources to a temporary directory.
8278
*

its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/AbstractMavenIntegrationTestCaseNIO2Test.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ void testExtractResourcesAsPath() throws IOException {
4444
}
4545

4646
@Test
47-
void testExtractResourcesBackwardCompatibility() throws IOException {
47+
void testPathToFileConversion() throws IOException {
4848
String resourcePath = "test-resource";
49-
50-
// Test that the old File-based method still works
51-
File result = extractResources(resourcePath);
52-
53-
assertNotNull(result);
54-
assertTrue(result.isAbsolute());
55-
assertTrue(result.getPath().endsWith(resourcePath));
56-
57-
// Verify that both methods return equivalent paths
49+
50+
// Test that Path can be converted to File when needed
5851
Path pathResult = extractResourcesAsPath(resourcePath);
59-
assertEquals(pathResult.toFile(), result);
52+
File fileResult = pathResult.toFile();
53+
54+
assertNotNull(fileResult);
55+
assertTrue(fileResult.isAbsolute());
56+
assertTrue(fileResult.getPath().endsWith(resourcePath));
57+
58+
// Verify round-trip conversion
59+
assertEquals(pathResult, fileResult.toPath());
6060
}
6161
}

its/core-it-support/maven-it-helper/src/test/java/org/apache/maven/it/NIO2MigrationVerificationTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ void testPathToStringPattern() throws IOException {
7676
}
7777

7878
@Test
79-
void testBackwardCompatibilityWithFileAPI() throws IOException {
80-
// Verify that the old File-based method still works
81-
java.io.File testDir = extractResources("test-resource");
82-
83-
assertNotNull(testDir);
84-
assertTrue(testDir.isAbsolute());
85-
assertTrue(testDir.getPath().endsWith("test-resource"));
86-
87-
// Verify both methods return equivalent paths
88-
Path pathResult = extractResourcesAsPath("test-resource");
89-
assertEquals(pathResult.toFile(), testDir);
79+
void testPathToFileConversion() throws IOException {
80+
// Verify that Path can be converted to File when needed for legacy APIs
81+
Path testDir = extractResourcesAsPath("test-resource");
82+
java.io.File fileDir = testDir.toFile();
83+
84+
assertNotNull(fileDir);
85+
assertTrue(fileDir.isAbsolute());
86+
assertTrue(fileDir.getPath().endsWith("test-resource"));
87+
88+
// Verify round-trip conversion
89+
assertEquals(testDir, fileDir.toPath());
9090
}
9191

9292
@Test

0 commit comments

Comments
 (0)