Skip to content

Commit 28045a0

Browse files
committed
parse surefire argline
1 parent 3cd8d17 commit 28045a0

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

pitest-maven/src/main/java/org/pitest/maven/SurefireConfigConverter.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public ReportOptions update(ReportOptions option, Xpp3Dom configuration) {
2929
convertExcludes(option, configuration);
3030
convertGroups(option, configuration);
3131
convertTestFailureIgnore(option, configuration);
32+
convertArgLine(option, configuration);
3233
return option;
3334
}
3435

@@ -68,6 +69,18 @@ private void convertExcludes(ReportOptions option, Xpp3Dom configuration) {
6869
option.setExcludedTestClasses(excludes);
6970
}
7071

72+
private void convertArgLine(ReportOptions option, Xpp3Dom configuration) {
73+
if (option.getArgLine() != null) {
74+
return;
75+
}
76+
77+
Xpp3Dom argLine = configuration.getChild("argLine");
78+
if (argLine != null) {
79+
option.setArgLine(argLine.getValue());
80+
}
81+
}
82+
83+
7184
private Predicate<String> filenameToClassFilter(String filename) {
7285
return new Glob(filename.replace(".java", "").replace("/", "."));
7386
}

pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ public void testAutoAddsKotlinSourceDirsWhenPresent() throws IOException {
471471

472472
}
473473

474-
475474
private ReportOptions parseConfig(final String xml) {
476475
try {
477476
final String pom = createPomWithConfiguration(xml);

pitest-maven/src/test/java/org/pitest/maven/SurefireConfigConverterTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,29 @@ public void shouldConvertTestFailureIgnoreWhenAbsent() throws Exception {
164164
assertThat(actual.skipFailingTests()).isFalse();
165165
}
166166

167+
@Test
168+
public void convertsArgline() throws Exception {
169+
this.surefireConfig = makeConfig("<argLine>-Xmx1024m</argLine>");
170+
171+
ReportOptions actual = this.testee
172+
.update(this.options, this.surefireConfig);
173+
174+
assertThat(actual.getArgLine()).isEqualTo("-Xmx1024m");
175+
}
176+
177+
@Test
178+
public void doesNotConvertArglineWhenAlreadySetInPitestConfig() throws Exception {
179+
this.surefireConfig = makeConfig("<argLine>-Xmx1024m</argLine>");
180+
181+
this.options.setArgLine("-foo");
182+
183+
ReportOptions actual = this.testee
184+
.update(this.options, this.surefireConfig);
185+
186+
assertThat(actual.getArgLine()).isEqualTo("-foo");
187+
}
188+
189+
167190
private Xpp3Dom makeConfig(String s) throws Exception {
168191
String xml = "<configuration>" + s + "</configuration>";
169192
InputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8"));

0 commit comments

Comments
 (0)