Skip to content

Commit 07108ee

Browse files
vivek-0509romani
authored andcommitted
Issue #18026: Resolve Pitest suppression for getExclusions
1 parent 31c29dd commit 07108ee

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

config/pitest-suppressions/pitest-main-suppressions.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,4 @@
88
<description>removed call to com/puppycrawl/tools/checkstyle/Main::getOutputStreamOptions</description>
99
<lineContent>getOutputStreamOptions(options.outputPath));</lineContent>
1010
</mutation>
11-
12-
<mutation unstable="false">
13-
<sourceFile>Main.java</sourceFile>
14-
<mutatedClass>com.puppycrawl.tools.checkstyle.Main$CliOptions</mutatedClass>
15-
<mutatedMethod>getExclusions</mutatedMethod>
16-
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
17-
<description>replaced call to java/util/stream/Stream::map with receiver</description>
18-
<lineContent>.map(Pattern::quote)</lineContent>
19-
</mutation>
2011
</suppressedMutations>

src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,6 +1978,34 @@ public void testPlainOutputFormatCreateListener() throws IOException {
19781978
.isInstanceOf(DefaultLogger.class);
19791979
}
19801980

1981+
@Test
1982+
public void testExcludeOptionDirectoryWithPlusInName(@SysErr Capturable systemErr,
1983+
@SysOut Capturable systemOut)
1984+
throws IOException {
1985+
1986+
final File specialDir = new File(temporaryFolder, "dir+name");
1987+
assertWithMessage("Directory must be created")
1988+
.that(specialDir.mkdirs())
1989+
.isTrue();
1990+
1991+
final File inputFile = new File(specialDir, "InputMainExclude.java");
1992+
Files.writeString(inputFile.toPath(),
1993+
"public class InputMainExclude { }" + System.lineSeparator());
1994+
1995+
final String dirPath = specialDir.getCanonicalPath();
1996+
1997+
assertMainReturnCode(-1, "-c", "/google_checks.xml", dirPath,
1998+
"-e", dirPath);
1999+
2000+
assertWithMessage("Unexpected output log")
2001+
.that(systemOut.getCapturedData())
2002+
.isEqualTo("Files to process must be specified, found 0."
2003+
+ System.lineSeparator());
2004+
assertWithMessage("Unexpected system error log")
2005+
.that(systemErr.getCapturedData())
2006+
.isEqualTo("");
2007+
}
2008+
19812009
/**
19822010
* Helper method to run {@link Main#main(String...)} and verify the exit code.
19832011
* Uses {@link Mockito#mockStatic(Class)} to mock method {@link Runtime#exit(int)}

0 commit comments

Comments
 (0)