Skip to content

Commit 239f3cc

Browse files
committed
Use Path.of
1 parent 51c4136 commit 239f3cc

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

api/maven-api-core/src/test/java/org/apache/maven/api/services/SourcesTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.InputStream;
2323
import java.nio.file.Files;
2424
import java.nio.file.Path;
25-
import java.nio.file.Paths;
2625

2726
import org.junit.jupiter.api.Test;
2827
import org.junit.jupiter.api.io.TempDir;
@@ -44,7 +43,7 @@ class SourcesTest {
4443

4544
@Test
4645
void testFromPath() {
47-
Path path = Paths.get("/tmp");
46+
Path path = Path.of("/tmp");
4847
Source source = Sources.fromPath(path);
4948

5049
assertNotNull(source);
@@ -54,7 +53,7 @@ void testFromPath() {
5453

5554
@Test
5655
void testBuildSource() {
57-
Path path = Paths.get("/tmp");
56+
Path path = Path.of("/tmp");
5857
ModelSource source = Sources.buildSource(path);
5958

6059
assertNotNull(source);
@@ -64,7 +63,7 @@ void testBuildSource() {
6463

6564
@Test
6665
void testResolvedSource() {
67-
Path path = Paths.get("/tmp");
66+
Path path = Path.of("/tmp");
6867
String location = "custom-location";
6968
ModelSource source = Sources.resolvedSource(path, location);
7069

@@ -77,7 +76,7 @@ void testResolvedSource() {
7776
@Test
7877
void testPathSourceFunctionality() {
7978
// Test basic source functionality
80-
Path path = Paths.get("/tmp");
79+
Path path = Path.of("/tmp");
8180
Sources.PathSource source = (Sources.PathSource) Sources.fromPath(path);
8281

8382
assertEquals(path.normalize(), source.getPath());
@@ -91,9 +90,9 @@ void testPathSourceFunctionality() {
9190
@Test
9291
void testBuildPathSourceFunctionality() {
9392
// Test build source functionality
94-
Path basePath = Paths.get("/tmp");
93+
Path basePath = Path.of("/tmp");
9594
ModelSource.ModelLocator locator = mock(ModelSource.ModelLocator.class);
96-
Path resolvedPath = Paths.get("/tmp/subproject/pom.xml");
95+
Path resolvedPath = Path.of("/tmp/subproject/pom.xml");
9796
when(locator.locateExistingPom(any(Path.class))).thenReturn(resolvedPath);
9897

9998
Sources.BuildPathSource source = (Sources.BuildPathSource) Sources.buildSource(basePath);
@@ -109,7 +108,7 @@ void testBuildPathSourceFunctionality() {
109108
@Test
110109
void testResolvedPathSourceFunctionality() {
111110
// Test resolved source functionality
112-
Path path = Paths.get("/tmp");
111+
Path path = Path.of("/tmp");
113112
String location = "custom-location";
114113
Sources.ResolvedPathSource source = (Sources.ResolvedPathSource) Sources.resolvedSource(path, location);
115114

0 commit comments

Comments
 (0)