Skip to content

Instantly share code, notes, and snippets.

@lordofthejars
Last active February 27, 2019 11:09
Show Gist options
  • Save lordofthejars/cc9e0e0da24a30df2e24a192f80e100b to your computer and use it in GitHub Desktop.
Save lordofthejars/cc9e0e0da24a30df2e24a192f80e100b to your computer and use it in GitHub Desktop.
@ExtendWith(OdoExecutorStubInjector.class)
public class OdoExecutorStubTest {
@Test
public void should_run_commands(OdoExecutorStub odoExecutorStub) {
// Given
final Odo odo = new Odo(odoExecutorStub);
// When
odo.createUrl().build().execute();
// Then
assertThat(odoExecutorStub).hasExecuted("odo url create");
}
@Test
public void should_run_commands_with_output(OdoExecutorStub odoExecutorStub) throws IOException {
// Given
final List<String> urlList = Files.readAllLines(Paths.get("src/test/resources", "url_list.json"));
final Odo odo = new Odo(odoExecutorStub);
// When
odoExecutorStub.recordOutput(urlList);
final UrlList list = odo.listUrls().build().execute();
// Then
assertThat(odoExecutorStub).hasExecuted("odo url list --output json");
Assertions.assertThat(list.getItems()).hasSize(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment