### Question:
Clique implements Postprocessor { public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } } @Inject  Clique(GraphDatabaseService graphDb, CliqueConfiguration cliqueConfiguration); @Override void run(); Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority);  }### Answer:
@Test public void prefixLeaderPrioritizer() { Node a = createNode("http: Node c = createNode("http: Node d = createNode("http: List<Node> cliqueNode = Arrays.asList(a, createNode("http: assertThat(clique.electCliqueLeader(cliqueNode, new ArrayList<String>()).getId(), is(a.getId())); assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("fake", "fake", "fake")).getId(), is(a.getId())); assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: }
@Test public void prefixLeaderPrioritizerWithReaIris() { Node a = createNode("http: Node b = createNode("http: List<Node> cliqueNode = Arrays.asList(a, b); assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: "http: }
@Test public void designatedLeaderPrioritizer() { Node a = createNode("http: Node b = createNode("http: Node c = createNode("http: Node d = createNode("http: c.setProperty(leaderAnnotation, true); List<Node> cliqueNode = Arrays.asList(a, b, c, d); assertThat(clique.electCliqueLeader(cliqueNode, new ArrayList<String>()).getId(), is(c.getId())); }
@Test public void designatedLeaderPrioritizerOverPriorityList() { Node a = createNode("http: Node b = createNode("http: Node c = createNode("http: Node d = createNode("http: c.setProperty(leaderAnnotation, true); List<String> priorityList = Arrays.asList("http: List<Node> cliqueNode = Arrays.asList(a, b, c, d); assertThat(clique.electCliqueLeader(cliqueNode, priorityList).getId(), is(c.getId())); }
@Test public void anonymousLeader() { Node a = createNode("http: Node b = createNode("http: Node c = createNode("http: a.addLabel(OwlLabels.OWL_ANONYMOUS); b.addLabel(OwlLabels.OWL_ANONYMOUS); List<Node> cliqueNode = Arrays.asList(a, b, c); assertThat(clique.electCliqueLeader(cliqueNode, new ArrayList<String>()).getId(), is(c.getId())); assertThat(clique.electCliqueLeader(Arrays.asList(a, b), new ArrayList<String>()).getId(), is(a.getId())); }