diff --git a/open-java-format/src/main/java/com/palantir/javaformat/java/Main.java b/open-java-format/src/main/java/com/palantir/javaformat/java/Main.java index a05188668..48c533435 100644 --- a/open-java-format/src/main/java/com/palantir/javaformat/java/Main.java +++ b/open-java-format/src/main/java/com/palantir/javaformat/java/Main.java @@ -273,7 +273,7 @@ public static CommandLineOptions processArgs(String... args) throws UsageExcepti throw new 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; } diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CommandLineFlagsTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CommandLineFlagsTest.java index 7ce5ee956..2dea6c882 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/CommandLineFlagsTest.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CommandLineFlagsTest.java @@ -102,11 +102,18 @@ public void inPlaceStdin() { @Test public void inPlaceDryRun() { + try { + Main.processArgs("--replace", "--dry-run", "A.java"); + fail("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("fail"); } catch (UsageException e) { - assertThat(e).hasMessageThat().contains("cannot use --dry-run and --in-place at the same time"); + assertThat(e).hasMessageThat().contains("cannot use --dry-run and --replace at the same time"); } }