Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static CommandLineOptions processArgs(String... args) throws UsageException {
"--assume-filename is only supported when formatting standard input");
}
if (parameters.dryRun() && parameters.inPlace()) {
throw new UsageException("cannot use --dry-run and --in-place at the same time");
throw new UsageException("cannot use --dry-run and --replace at the same time");
}
return parameters;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,22 @@ public void inPlaceStdin() {

@Test
public void inPlaceDryRun() {
try {
Main.processArgs("--replace", "--dry-run", "A.java");
fail();
} catch (UsageException e) {
assertThat(e)
.hasMessageThat()
.contains("cannot use --dry-run and --replace at the same time");
}

try {
Main.processArgs("-i", "-n", "A.java");
fail();
} catch (UsageException e) {
assertThat(e)
.hasMessageThat()
.contains("cannot use --dry-run and --in-place at the same time");
.contains("cannot use --dry-run and --replace at the same time");
}
}

Expand Down