RepositoryManagerFederator { public void addFed(String fedID, String description, Collection<String> members, boolean readonly, boolean distinct) throws MalformedURLException, RDF4JException { if (members.contains(fedID)) { throw new RepositoryConfigException("A federation member may not have the same ID as the federation."); } Model graph = new LinkedHashModel(); BNode fedRepoNode = valueFactory.createBNode(); LOGGER.debug("Federation repository root node: {}", fedRepoNode); addToGraph(graph, fedRepoNode, RDF.TYPE, RepositoryConfigSchema.REPOSITORY); addToGraph(graph, fedRepoNode, RepositoryConfigSchema.REPOSITORYID, valueFactory.createLiteral(fedID)); addToGraph(graph, fedRepoNode, RDFS.LABEL, valueFactory.createLiteral(description)); addImplementation(members, graph, fedRepoNode, readonly, distinct); RepositoryConfig fedConfig = RepositoryConfig.create(graph, fedRepoNode); fedConfig.validate(); manager.addRepositoryConfig(fedConfig); } RepositoryManagerFederator(RepositoryManager manager); void addFed(String fedID, String description, Collection<String> members, boolean readonly, boolean distinct);  }
@Test public final void testDirectRecursiveAddThrowsException() throws MalformedURLException, RDF4JException { String id = "fedtest"; assertThatThrownBy(() -> federator.addFed(id, "Federation Test", Arrays.asList(new String[] { id, "ignore" }), true, false)).isInstanceOf(RepositoryConfigException.class) .hasMessage("A federation member may not have the same ID as the federation."); }