@Test public void detectContextSourceWithCustomNameShouldCustomizeDependency() { ContextSource ctx = Mockito.mock(ContextSource.class); LdapRelationshipDetector detector = new LdapRelationshipDetector(Arrays.asList(ctx)); String name = "dir"; detector.setDefaultName(name); Set<Relationship> actual = detector.detect(); Dependency dependency = Dependency.on(Component.of(name, "directory/ldap")); Set<Relationship> expected = new HashSet<>(); expected.add(dependency); Assertions.assertThat(detector.getDefaultName()).isEqualTo(name); Assertions.assertThat(actual).isEqualTo(expected); }
@Override public Set<Relationship> detect() { if (contextSources.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.LDAP)).asRelationshipSet(); }
LdapRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (contextSources.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.LDAP)).asRelationshipSet(); } }
LdapRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (contextSources.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.LDAP)).asRelationshipSet(); } LdapRelationshipDetector(List<ContextSource> sources); }
LdapRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (contextSources.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.LDAP)).asRelationshipSet(); } LdapRelationshipDetector(List<ContextSource> sources); @Override Set<Relationship> detect(); }
LdapRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (contextSources.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.LDAP)).asRelationshipSet(); } LdapRelationshipDetector(List<ContextSource> sources); @Override Set<Relationship> detect();  }