@Test public void getHost() { List<Host> hosts = new ArrayList<>(); HostFake host1 = new HostFake("host1", 1, 1024, 10, 0, 0, 0); HostFake host2 = new HostFake("host2", 2, 2048, 20, 0, 0, 0); hosts.add(host1); hosts.add(host2); HostsManager hostsManager = new HostsManager(hosts); assertEquals(host1, hostsManager.getHost("host1")); assertEquals(host2, hostsManager.getHost("host2")); }
public Host getHost(String hostname) { for (Host host: hosts) { if (hostname.equals(host.getHostname())) { host.refreshMonitoringInfo(); return host; } } return null; }
HostsManager { public Host getHost(String hostname) { for (Host host: hosts) { if (hostname.equals(host.getHostname())) { host.refreshMonitoringInfo(); return host; } } return null; } }
HostsManager { public Host getHost(String hostname) { for (Host host: hosts) { if (hostname.equals(host.getHostname())) { host.refreshMonitoringInfo(); return host; } } return null; } HostsManager(List<Host> hosts); }
HostsManager { public Host getHost(String hostname) { for (Host host: hosts) { if (hostname.equals(host.getHostname())) { host.refreshMonitoringInfo(); return host; } } return null; } HostsManager(List<Host> hosts); List<Host> getHosts(); Host getHost(String hostname); void pressHostPowerButton(String hostname); }
HostsManager { public Host getHost(String hostname) { for (Host host: hosts) { if (hostname.equals(host.getHostname())) { host.refreshMonitoringInfo(); return host; } } return null; } HostsManager(List<Host> hosts); List<Host> getHosts(); Host getHost(String hostname); void pressHostPowerButton(String hostname);  }