Skip to content

Commit 0f50103

Browse files
authored
test: give project root other than root directory (#9)
1 parent 80e46f7 commit 0f50103

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "src/test/resources/arthas/arthas"]
88
path = src/test/resources/arthas/arthas
99
url = [email protected]:alibaba/arthas.git
10+
[submodule "src/test/resources/persistence/persistence"]
11+
path = src/test/resources/persistence/persistence
12+
url = [email protected]:jakartaee/persistence.git

src/test/java/io/github/algomaster99/maven_module_graph/MavenModuleTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,23 @@ void arthas_mavenProperties(@TempDir Path temp) throws XmlPullParserException, I
7272
assertThat(Files.readString(expectedJson), equalTo(Files.readString(actualJson)));
7373
}
7474

75+
@Test
76+
void persistence_differentProjectRoot(@TempDir Path temp) throws XmlPullParserException, IOException {
77+
// arrange
78+
MavenModule module = Utility.createMavenModuleGraph(Path.of("src/test/resources/persistence/persistence/api"), null, new HashMap<>());
79+
Path expectedPlainText = Path.of("src/test/resources/persistence/output.txt");
80+
Path actualPlainText = temp.resolve("arthas.txt");
81+
82+
Path expectedJson = Path.of("src/test/resources/persistence/output.json");
83+
Path actualJson = temp.resolve("arthas.json");
84+
85+
// act
86+
Utility.printToFile(module, actualPlainText, 0);
87+
Utility.printToJson(module, actualJson, 2);
88+
89+
// assert
90+
assertThat(Files.readString(expectedPlainText), equalTo(Files.readString(actualPlainText)));
91+
assertThat(Files.readString(expectedJson), equalTo(Files.readString(actualJson)));
92+
}
93+
7594
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"depth" : 0,
3+
"groupId" : "jakarta.persistence",
4+
"artifactId" : "jakarta.persistence-api",
5+
"version" : "4.0.0-SNAPSHOT"
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jakarta.persistence:jakarta.persistence-api:4.0.0-SNAPSHOT
Submodule persistence added at 1aac75c

0 commit comments

Comments
 (0)