@Test public void getHostReturnsNullWhenDoesNotExist() { HostsManager hostsManager = new HostsManager(new ArrayList<Host>()); assertNull(hostsManager.getHost("NonExistingHost")); }
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);  }