[Demonstration 1]

[Buggy Method]
private void startListeningAnswers(Question question) {
    try {
        ServerHandlerFactory.createListeningHandler(question, this);
    } catch (SoftClickerException e) {
        log.error("Cannot start listening server for question '" + question + "'");
    }
    log.info("Server started listening answers for question '" + question + "'");
}

[Buggy Hunk]
ServerHandlerFactory.createListeningHandler(question, this);

[Patch]
listeningHandler = ServerHandlerFactory.createListeningHandler(question, this);

[Demonstration 2]

[Buggy Method]
protected void handleIntersections(Graph graph, ArrayList<GraphPoint> intersections) {
    LineEvaluator evaluator = new LineEvaluator(graph);
    if (intersections.size() >= 3) {
        System.err.println("More than 3 intersections in the graph");
    }
    ArrayList<GraphLine> removables = new ArrayList<>();
    for (GraphPoint intersection : intersections) {
        for (GraphLine line : intersection.getLines()) {
            line.setEvaluator(evaluator);
            removables.add(line);
        }
    }
    while (removables.size() > 0) {
        MostGetter<GraphLine> mostGetter = new MostGetter<>(GraphLine::getEvaluationValue);
        GraphLine worst = mostGetter.getMost(removables, true);
        GraphPoint p1 = worst.getPoint1();
        GraphPoint p2 = worst.getPoint2();
        if (p1.getLineCount() >= 3 || p2.getLineCount() >= 3) {
            //int preRemovalGraphSize = Graph.connectedGraphCount(p1);
            //test removal
            worst.remove();
            if (/*preRemovalGraphSize != Graph.connectedGraphCount(p1)*/
            false) {
                new GraphLine(p1, p2);
            }
        }
        removables.remove(worst);
    }
}

[Buggy Hunk]
if (p1.getLineCount() >= 3 || p2.getLineCount() >= 3)

[Patch]
if (p1.getLineCount() >= 3 && p2.getLineCount() >= 2 || p1.getLineCount() >= 2 && p2.getLineCount() >= 3)

[Demonstration 3]

[Buggy Method]
private void testNegotiation(int amount, TestContext context) {
    Async async = context.async();
    // Vertx vertx = Vertx.vertx();
    PrimaryVertex pv = new PrimaryVertex();
    GDHVertex[] verticles = new GDHVertex[amount];
    Configuration[] confs = new Configuration[amount];
    for (int i = 0; i < amount; i++) {
        verticles[i] = new GDHVertex();
        confs[i] = new Configuration();
        String port = amount + "08" + i;
        confs[i].setIP("localhost").setPort(port).setLogLevel(Level.DEBUG);
        verticles[i].setConfiguration(confs[i]);
    }
    List<GDHVertex> list = new ArrayList<>(Arrays.asList(verticles));
    Group g = new Group(confs[0], list.stream().map(y -> y.getNode()).collect(Collectors.toList()));
    verticles[0].addGroup(g);
    for (int i = 0; i < amount; i++) pv.run(verticles[i], res -> {
        if (res.succeeded()) {
            async.countDown();
        } else {
            res.cause().printStackTrace();
            return;
        }
    });
    async.awaitSuccess();
    BigInteger key = null;
    try {
        key = verticles[0].exchange(g.getGroupId()).get();
        for (int j = 0; j < verticles.length; j++) {
            System.out.println("CANDIDATE " + verticles[j].getKey(g.getGroupId()).get());
        }
        for (int j = 0; j < verticles.length; j++) {
            Assert.assertEquals(verticles[j].getKey(g.getGroupId()).get(), key);
        }
    } catch (InterruptedException | ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    // vertx.deploymentIDs().forEach(vertx::undeploy);
    for (int i = 0; i < amount; i++) pv.kill(verticles[i], res -> {
        if (res.succeeded()) {
            async.countDown();
        } else {
            res.cause().printStackTrace();
        }
    });
}

[Buggy Hunk]
System.out.println("CANDIDATE " + verticles[j].getKey(g.getGroupId()).get());

[Patch]
System.out.println("CANDIDATE " + " " + verticles[j].getKey(g.getGroupId()).get());