@Test public void detectRelationshipsBasedOnPropertiesShouldReturnDependenciesAndConsumers() { CereebroProperties properties = new CereebroProperties(); ComponentRelationshipsProperties application = new ComponentRelationshipsProperties(); DependencyProperties d = new DependencyProperties(); ConsumerProperties c = new ConsumerProperties(); ComponentProperties consumer = new ComponentProperties(); consumer.setName("apocalypse"); consumer.setType("villain"); c.setComponent(consumer); application.setConsumers(Arrays.asList(c)); ComponentProperties dependency = new ComponentProperties(); dependency.setName("wolverine"); dependency.setType("superhero"); d.setComponent(dependency); application.setDependencies(Arrays.asList(d)); properties.setApplication(application); Set<Relationship> expected = new HashSet<>(Arrays.asList(Dependency.on(Component.of("wolverine", "superhero")), Consumer.by(Component.of("apocalypse", "villain")))); ConfigurationPropertiesRelationshipDetector detector = new ConfigurationPropertiesRelationshipDetector( properties); Set<Relationship> actual = detector.detect(); Assert.assertEquals(expected, actual); }
@Override public Set<Relationship> detect() { return properties.getApplication().getRelationships(); }
ConfigurationPropertiesRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { return properties.getApplication().getRelationships(); } }
ConfigurationPropertiesRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { return properties.getApplication().getRelationships(); } ConfigurationPropertiesRelationshipDetector(CereebroProperties properties); }
ConfigurationPropertiesRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { return properties.getApplication().getRelationships(); } ConfigurationPropertiesRelationshipDetector(CereebroProperties properties); @Override Set<Relationship> detect(); }
ConfigurationPropertiesRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { return properties.getApplication().getRelationships(); } ConfigurationPropertiesRelationshipDetector(CereebroProperties properties); @Override Set<Relationship> detect();  }