// Path: breakerbox-service/src/main/java/com/yammer/breakerbox/service/core/Instances.java
// public class Instances {
//     private static final Logger LOGGER = LoggerFactory.getLogger(Instances.class);
// 
//     public static Collection<Instance> instances() {
//         try {
//             return PluginsFactory.getInstanceDiscovery().getInstanceList();
//         } catch (Exception err) {
//             LOGGER.warn("Could not fetch clusters dynamically", err);
//         }
// 
//         return ImmutableList.of();
//     }
// 
//     public static Collection<String> clusters() {
//         return instances()
//                 .stream()
//                 .map(Instance::getCluster)
//                 .sorted()
//                 .collect(Collectors.toCollection(TreeSet::new));
//     }
// 
//     public static Collection<String> noMetaClusters(Set<String> specifiedMetaClusters) {
//         return instances()
//                 .stream()
//                 .filter((instance) -> !specifiedMetaClusters.contains(instance.getCluster().toUpperCase()))
//                 .map(Instance::getCluster)
//                 .sorted()
//                 .collect(Collectors.toCollection(TreeSet::new));
//     }
// 
//     public static Collection<Instance> instances(ServiceId serviceId) {
//         return instances()
//                 .stream()
//                 .filter((instance) -> instance.getCluster().equals(serviceId.getId()))
//                 .sorted()
//                 .collect(Collectors.toList());
//     }
// 
//     public static String toInstanceId(Instance instance) {
//         return instance.getAttributes().get(TurbineInstanceDiscovery.BREAKERBOX_INSTANCE_ID);
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/ServiceId.java
// public class ServiceId {
//     private final String id;
// 
//     private ServiceId(String id) {
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static ServiceId from(String id) {
//         return new ServiceId(id);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final ServiceId other = (ServiceId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: breakerbox-turbine/src/main/java/com/yammer/breakerbox/turbine/YamlInstanceDiscovery.java
// public class YamlInstanceDiscovery implements InstanceDiscovery {
//     private static final Logger LOGGER = LoggerFactory.getLogger(YamlInstanceDiscovery.class);
//     private final Path path;
//     private final ConfigurationFactory<YamlInstanceConfiguration> configurationFactory;
// 
//     public YamlInstanceDiscovery(Path path,
//                                  Validator validator,
//                                  ObjectMapper objectMapper) {
//         this.path = path;
//         this.configurationFactory = new YamlConfigurationFactory<>(
//                 YamlInstanceConfiguration.class,
//                 validator,
//                 objectMapper,
//                 "dw");
//         parseYamlInstanceConfiguration();
//     }
// 
//     @Override
//     public Collection<Instance> getInstanceList() throws Exception {
//         return parseYamlInstanceConfiguration()
//                 .orElse(new YamlInstanceConfiguration())
//                 .getAllInstances();
//     }
// 
//     private Optional<YamlInstanceConfiguration> parseYamlInstanceConfiguration() {
//         try {
//             return Optional.of(configurationFactory.build(path.toFile()));
//         } catch (Exception err) {
//             LOGGER.error("Unable to parse {}", path.toAbsolutePath(), err);
//         }
//         return Optional.empty();
//     }
// }


import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
import com.netflix.turbine.discovery.Instance;
import com.netflix.turbine.plugins.PluginsFactory;
import com.yammer.breakerbox.service.core.Instances;
import com.yammer.breakerbox.store.ServiceId;
import com.yammer.breakerbox.turbine.YamlInstanceDiscovery;
import io.dropwizard.jackson.Jackson;
import io.dropwizard.jersey.validation.Validators;
import org.junit.BeforeClass;
import org.junit.Test;
import java.net.URI;
import java.nio.file.Paths;
import java.util.Set;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
package com.yammer.breakerbox.service.core.tests;




public class InstancesTest {
    @BeforeClass
    public static void setupTest() throws Exception {
// Path: breakerbox-service/src/main/java/com/yammer/breakerbox/service/core/Instances.java
// public class Instances {
//     private static final Logger LOGGER = LoggerFactory.getLogger(Instances.class);
// 
//     public static Collection<Instance> instances() {
//         try {
//             return PluginsFactory.getInstanceDiscovery().getInstanceList();
//         } catch (Exception err) {
//             LOGGER.warn("Could not fetch clusters dynamically", err);
//         }
// 
//         return ImmutableList.of();
//     }
// 
//     public static Collection<String> clusters() {
//         return instances()
//                 .stream()
//                 .map(Instance::getCluster)
//                 .sorted()
//                 .collect(Collectors.toCollection(TreeSet::new));
//     }
// 
//     public static Collection<String> noMetaClusters(Set<String> specifiedMetaClusters) {
//         return instances()
//                 .stream()
//                 .filter((instance) -> !specifiedMetaClusters.contains(instance.getCluster().toUpperCase()))
//                 .map(Instance::getCluster)
//                 .sorted()
//                 .collect(Collectors.toCollection(TreeSet::new));
//     }
// 
//     public static Collection<Instance> instances(ServiceId serviceId) {
//         return instances()
//                 .stream()
//                 .filter((instance) -> instance.getCluster().equals(serviceId.getId()))
//                 .sorted()
//                 .collect(Collectors.toList());
//     }
// 
//     public static String toInstanceId(Instance instance) {
//         return instance.getAttributes().get(TurbineInstanceDiscovery.BREAKERBOX_INSTANCE_ID);
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/ServiceId.java
// public class ServiceId {
//     private final String id;
// 
//     private ServiceId(String id) {
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static ServiceId from(String id) {
//         return new ServiceId(id);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final ServiceId other = (ServiceId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: breakerbox-turbine/src/main/java/com/yammer/breakerbox/turbine/YamlInstanceDiscovery.java
// public class YamlInstanceDiscovery implements InstanceDiscovery {
//     private static final Logger LOGGER = LoggerFactory.getLogger(YamlInstanceDiscovery.class);
//     private final Path path;
//     private final ConfigurationFactory<YamlInstanceConfiguration> configurationFactory;
// 
//     public YamlInstanceDiscovery(Path path,
//                                  Validator validator,
//                                  ObjectMapper objectMapper) {
//         this.path = path;
//         this.configurationFactory = new YamlConfigurationFactory<>(
//                 YamlInstanceConfiguration.class,
//                 validator,
//                 objectMapper,
//                 "dw");
//         parseYamlInstanceConfiguration();
//     }
// 
//     @Override
//     public Collection<Instance> getInstanceList() throws Exception {
//         return parseYamlInstanceConfiguration()
//                 .orElse(new YamlInstanceConfiguration())
//                 .getAllInstances();
//     }
// 
//     private Optional<YamlInstanceConfiguration> parseYamlInstanceConfiguration() {
//         try {
//             return Optional.of(configurationFactory.build(path.toFile()));
//         } catch (Exception err) {
//             LOGGER.error("Unable to parse {}", path.toAbsolutePath(), err);
//         }
//         return Optional.empty();
//     }
// }


// Path: breakerbox-service/src/test/java/com/yammer/breakerbox/service/core/tests/InstancesTest.java
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
import com.netflix.turbine.discovery.Instance;
import com.netflix.turbine.plugins.PluginsFactory;
import com.yammer.breakerbox.service.core.Instances;
import com.yammer.breakerbox.store.ServiceId;
import com.yammer.breakerbox.turbine.YamlInstanceDiscovery;
import io.dropwizard.jackson.Jackson;
import io.dropwizard.jersey.validation.Validators;
import org.junit.BeforeClass;
import org.junit.Test;
import java.net.URI;
import java.nio.file.Paths;
import java.util.Set;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;

package com.yammer.breakerbox.service.core.tests;




public class InstancesTest {
    @BeforeClass
    public static void setupTest() throws Exception {
        PluginsFactory.setInstanceDiscovery(new YamlInstanceDiscovery(