Skip to content

Commit

Permalink
deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Kruszewski committed Jun 25, 2020
1 parent dfef565 commit f36952e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.palantir.conjure.defs;

import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.collect.ImmutableList;
import java.io.IOException;
Expand Down
18 changes: 14 additions & 4 deletions conjure/src/test/java/com/palantir/conjure/cli/ConjureCliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public void correctlyParseArguments() {
.outputIrFile(outputFile)
.putExtensions("foo", "bar")
.build();
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli()).parseArgs(args).asCommandLineList().get(1).getCommand();
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli()).parseArgs(args)
.asCommandLineList()
.get(1)
.getCommand();
assertThat(cmd.getConfiguration()).isEqualTo(expectedConfiguration);
}

Expand All @@ -68,14 +71,18 @@ public void discoversFilesInDirectory() {
.inputFiles(ImmutableList.of(inputFile))
.outputIrFile(outputFile)
.build();
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli()).parse(args).get(1).getCommand();
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli())
.parseArgs(args)
.asCommandLineList()
.get(1)
.getCommand();
assertThat(cmd.getConfiguration()).isEqualTo(expectedConfiguration);
}

@Test
public void throwsWhenOutputIsDirectory() {
String[] args = {"compile", folder.getRoot().getAbsolutePath(), folder.getRoot().getAbsolutePath()};
assertThatThrownBy(() -> CommandLine.run(new ConjureCli(), args))
assertThatThrownBy(() -> new CommandLine(new ConjureCli()).execute(args))
.isInstanceOf(CommandLine.ExecutionException.class)
.hasMessageContaining("Output IR file should not be a directory");
}
Expand Down Expand Up @@ -106,7 +113,10 @@ public void doesNotThrowWhenUnexpectedFeature() {
@Test
public void throwsWhenInvalidExtensions() {
String[] args = {"compile", inputFile.getAbsolutePath(), outputFile.getAbsolutePath(), "--extensions", "foo"};
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli()).parse(args).get(1).getCommand();
ConjureCli.CompileCommand cmd = new CommandLine(new ConjureCli()).parseArgs(args)
.asCommandLineList()
.get(1)
.getCommand();
assertThatThrownBy(cmd::getConfiguration)
.isInstanceOf(SafeIllegalArgumentException.class)
.hasMessage("Failed to parse extensions");
Expand Down

0 comments on commit f36952e

Please sign in to comment.