|
27 | 27 |
|
28 | 28 | import java.io.File; |
29 | 29 | import java.io.IOException; |
| 30 | +import java.nio.file.Paths; |
30 | 31 | import java.util.Map; |
31 | 32 | import java.util.Properties; |
32 | 33 |
|
@@ -219,19 +220,19 @@ private void assertShortDescribe(String commitDescribe, String expectedShortDesc |
219 | 220 | public void testCraftPropertiesOutputFileWithRelativePath() throws IOException { |
220 | 221 | GitCommitIdMojo commitIdMojo = new GitCommitIdMojo(); |
221 | 222 | File baseDir = new File("."); |
222 | | - String targetDir = baseDir.getCanonicalPath() + "/"; |
223 | | - String generateGitPropertiesFilename = "target/classes/git.properties"; |
| 223 | + String targetDir = baseDir.getCanonicalPath(); |
| 224 | + String generateGitPropertiesFilename = Paths.get(targetDir, "target", "classes", "git.properties").toString(); |
224 | 225 |
|
225 | 226 | File result = commitIdMojo.craftPropertiesOutputFile(baseDir, generateGitPropertiesFilename); |
226 | | - assertThat(result.getCanonicalPath()).isEqualTo(targetDir + generateGitPropertiesFilename); |
| 227 | + assertThat(result.getCanonicalPath()).isEqualTo(generateGitPropertiesFilename); |
227 | 228 | } |
228 | 229 |
|
229 | 230 | @Test |
230 | 231 | public void testCraftPropertiesOutputFileWithFullPath() throws IOException { |
231 | 232 | GitCommitIdMojo commitIdMojo = new GitCommitIdMojo(); |
232 | 233 | File baseDir = new File("."); |
233 | | - String targetDir = baseDir.getCanonicalPath() + "/"; |
234 | | - String generateGitPropertiesFilename = targetDir + "target/classes/git.properties"; |
| 234 | + String targetDir = baseDir.getCanonicalPath(); |
| 235 | + String generateGitPropertiesFilename = Paths.get(targetDir, "target", "classes", "git.properties").toString(); |
235 | 236 |
|
236 | 237 | File result = commitIdMojo.craftPropertiesOutputFile(baseDir, generateGitPropertiesFilename); |
237 | 238 | assertThat(result.getCanonicalPath()).isEqualTo(generateGitPropertiesFilename); |
|
0 commit comments