### Question:
ServiceDependencyResolver { static boolean doesDependOn(String service1, String service2, Multimap<String, String> dependencies) { if (service1.equals(service2)) { return false; } Queue<String> servicesToSearch = new LinkedList<String>(); servicesToSearch.addAll(dependencies.get(service1)); while (!servicesToSearch.isEmpty()) { String dependentService = servicesToSearch.remove(); if (dependentService.equals(service2)) { return true; } servicesToSearch.addAll(dependencies.get(dependentService)); } return false; } ServiceDependencyResolver(Actions actions, Map<String, Service> clusterServices); Set<ActionOnService> getDirectDependentActions(String service, ProvisionerAction action); boolean runtimeDependsOn(String service1, String service2);  }### Answer:
@Test public void testDependsOn() { Multimap<String, String> dependencies = HashMultimap.create(); dependencies.put("s2", "s1"); dependencies.put("s3", "s1"); dependencies.put("s4", "s3"); dependencies.put("s4", "s2"); dependencies.put("s5", "s3"); dependencies.put("s6", "s4"); dependencies.put("s7", "s4"); Map<String, Set<String>> serviceDeps = Maps.newHashMap(); serviceDeps.put("s1", ImmutableSet.<String>of()); serviceDeps.put("s2", ImmutableSet.<String>of("s1")); serviceDeps.put("s3", ImmutableSet.<String>of("s1")); serviceDeps.put("s4", ImmutableSet.<String>of("s1", "s2", "s3")); serviceDeps.put("s5", ImmutableSet.<String>of("s1", "s3")); serviceDeps.put("s6", ImmutableSet.<String>of("s1", "s2", "s3", "s4")); serviceDeps.put("s7", ImmutableSet.<String>of("s1", "s2", "s3", "s4")); for (String service1 : serviceDeps.keySet()) { for (String service2 : serviceDeps.keySet()) { Assert.assertEquals(serviceDeps.get(service1).contains(service2), ServiceDependencyResolver.doesDependOn(service1, service2, dependencies)); } } }