use of org.eclipse.che.plugin.docker.client.params.network.GetNetworksParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToGetNetworksWithParams.
@Test
public void shouldBeAbleToGetNetworksWithParams() throws Exception {
// given
Network network = createNetwork();
List<Network> originNetworks = singletonList(network);
ByteArrayInputStream inputStream = new ByteArrayInputStream(GSON.toJson(originNetworks).getBytes());
doReturn(inputStream).when(dockerResponse).getInputStream();
GetNetworksParams getNetworksParams = GetNetworksParams.create().withFilters(new Filters().withFilter("key", "value1", "value2"));
// when
List<Network> actual = dockerConnector.getNetworks(getNetworksParams);
// then
assertEquals(actual, originNetworks);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_GET);
verify(dockerConnection).path("/networks");
verify(dockerConnection).query(eq("filters"), anyObject());
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
verify(dockerResponse).getInputStream();
}
Aggregations