use of org.eclipse.che.plugin.docker.client.params.RemoveNetworkParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowExceptionOnRemoveNetworkIfResponseCodeIsNot20x.
@Test(expectedExceptions = NetworkNotFoundException.class, expectedExceptionsMessageRegExp = "exc_message")
public void shouldThrowExceptionOnRemoveNetworkIfResponseCodeIsNot20x() throws Exception {
// given
doReturn(404).when(dockerResponse).getStatus();
ByteArrayInputStream inputStream = new ByteArrayInputStream("exc_message".getBytes());
doReturn(inputStream).when(dockerResponse).getInputStream();
RemoveNetworkParams removeNetworkParams = RemoveNetworkParams.create("net_id");
// when
dockerConnector.removeNetwork(removeNetworkParams);
}
use of org.eclipse.che.plugin.docker.client.params.RemoveNetworkParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToRemoveNetworkWithParams.
@Test
public void shouldBeAbleToRemoveNetworkWithParams() throws Exception {
// given
String netId = "net_id";
RemoveNetworkParams removeNetworkParams = RemoveNetworkParams.create(netId);
// when
dockerConnector.removeNetwork(removeNetworkParams);
// then
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_DELETE);
verify(dockerConnection).path("/networks/" + netId);
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
}
Aggregations