Skip to content

Commit

Permalink
Avoid duplicate literals (PMD)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Apr 29, 2024
1 parent b7fb8d9 commit d7d9cdf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/java/rife/bld/extension/CheckstyleOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,21 @@ void debug() {
@Test
void exclude() {
var op = new CheckstyleOperation().fromProject(new Project()).exclude(FOO, BAR);
assertThat(op.executeConstructProcessCommandList()).contains("-e " + FOO, "-e " + BAR);
var e = "-e ";
assertThat(op.executeConstructProcessCommandList()).contains(e + FOO, e + BAR);

op = new CheckstyleOperation().fromProject(new Project()).exclude(List.of(FOO, BAR));
assertThat(op.executeConstructProcessCommandList()).as("as list").contains("-e " + FOO, "-e " + BAR);
assertThat(op.executeConstructProcessCommandList()).as("as list").contains(e + FOO, e + BAR);
}

@Test
void excludeRegex() {
var op = new CheckstyleOperation().fromProject(new Project()).excludeRegex(FOO, BAR);
assertThat(op.executeConstructProcessCommandList()).contains("-x " + FOO, "-x " + BAR);
var x = "-x ";
assertThat(op.executeConstructProcessCommandList()).contains(x + FOO, x + BAR);

op = new CheckstyleOperation().fromProject(new Project()).excludeRegex(List.of(FOO, BAR));
assertThat(op.executeConstructProcessCommandList()).as("as list").contains("-x " + FOO, "-x " + BAR);
assertThat(op.executeConstructProcessCommandList()).as("as list").contains(x + FOO, x + BAR);
}


Expand Down

0 comments on commit d7d9cdf

Please sign in to comment.