gnodet-bot commented on code in PR #13399:
URL: https://github.com/apache/maven/pull/13399#discussion_r4237020595
##########
apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java:
##########
@@ -48,4 +52,28 @@ void testValidGlobalSettings() throws Exception {
new SettingsXpp3Reader().read(reader);
}
}
+
+ @Test
+ void testGlobalSettingsInterpolation() throws Exception {
+ assertGlobalSettingsBuild("/home/user");
+ }
+
+ @Test
+ void testGlobalSettingsInterpolationWithDoubleHyphen() throws Exception {
+ assertGlobalSettingsBuild("/foo--bar/");
+ }
+
+ private void assertGlobalSettingsBuild(String userHome) throws Exception {
+ String basedir = System.getProperty("basedir",
System.getProperty("user.dir"));
+
+ Properties systemProperties = new Properties();
+ systemProperties.setProperty("user.home", userHome);
+ systemProperties.setProperty("maven.conf", new File(basedir,
"src/conf").getAbsolutePath());
+
+ DefaultSettingsBuildingRequest request = new
DefaultSettingsBuildingRequest();
+ request.setGlobalSettingsFile(new File(basedir,
"src/conf/settings.xml"));
+ request.setSystemProperties(systemProperties);
+
+ assertNotNull(new
DefaultSettingsBuilderFactory().newInstance().build(request));
Review Comment:
💡 **Nit:** `assertNotNull` is redundant here — `build()` either returns a
result or throws a `SettingsBuildingException`. The real assertion is already
implicit (test fails on exception). Consider dropping the wrapper:
```suggestion
new DefaultSettingsBuilderFactory().newInstance().build(request);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]