|
18 | 18 | */ |
19 | 19 | package org.apache.maven.cling.invoker.mvnup; |
20 | 20 |
|
| 21 | +import java.io.ByteArrayOutputStream; |
| 22 | +import java.nio.charset.StandardCharsets; |
| 23 | + |
21 | 24 | import org.apache.commons.cli.ParseException; |
22 | 25 | import org.apache.maven.api.cli.mvnup.UpgradeOptions; |
| 26 | +import org.apache.maven.cling.MavenUpCling; |
| 27 | +import org.codehaus.plexus.classworlds.ClassWorld; |
23 | 28 | import org.junit.jupiter.api.Test; |
24 | 29 |
|
25 | 30 | import static org.junit.jupiter.api.Assertions.assertEquals; |
@@ -190,4 +195,25 @@ void testInterpolationWithPluginsOption() throws ParseException { |
190 | 195 | assertTrue(interpolated.plugins().isPresent(), "Interpolated options should preserve --plugins"); |
191 | 196 | assertTrue(interpolated.plugins().get(), "Interpolated --plugins should be true"); |
192 | 197 | } |
| 198 | + |
| 199 | + @Test |
| 200 | + void helpMentionsInferInDefault() throws Exception { |
| 201 | + ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| 202 | + ByteArrayOutputStream err = new ByteArrayOutputStream(); |
| 203 | + |
| 204 | + int exit = MavenUpCling.main( |
| 205 | + new String[] {"--help"}, |
| 206 | + new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader()), |
| 207 | + null, |
| 208 | + out, |
| 209 | + err); |
| 210 | + |
| 211 | + String help = out.toString(StandardCharsets.UTF_8); |
| 212 | + assertEquals(0, exit, "mvnup --help should exit 0"); |
| 213 | + assertTrue( |
| 214 | + help.contains("Default behavior: --model --plugins --infer"), |
| 215 | + "Help footer should advertise --infer as part of the defaults"); |
| 216 | + assertFalse( |
| 217 | + help.contains("Default behavior: --model and --plugins"), "Old/incorrect default text must be gone"); |
| 218 | + } |
193 | 219 | } |
0 commit comments