use of com.oracle.bedrock.runtime.docker.commands.Stop in project oracle-bedrock by coherence-community.
the class DockerContainerTest method shouldStopContainer.
@Test
public void shouldStopContainer() throws Exception {
Docker docker = Docker.auto();
Platform platform = mock(Platform.class);
Application application = mock(Application.class, "App");
Application removeApp = mock(Application.class, "Inspect");
DockerContainer container = new DockerContainer("foo", OptionsByType.of(docker));
when(application.getPlatform()).thenReturn(platform);
when(platform.launch(any(MetaClass.class), anyVararg())).thenReturn(removeApp);
container.onAddingTo(application);
container.stop();
ArgumentCaptor<MetaClass> captor = ArgumentCaptor.forClass(MetaClass.class);
verify(platform).launch(captor.capture(), anyVararg());
OptionsByType optionsByType = OptionsByType.empty();
Stop stop = (Stop) captor.getValue();
assertThat(stop, is(notNullValue()));
stop.onLaunch(platform, optionsByType);
Arguments arguments = optionsByType.get(Arguments.class);
List<String> values = arguments.resolve(mock(Platform.class), OptionsByType.empty());
assertThat(values, contains("stop", "foo"));
}
Aggregations