[Demonstration 1]

[Buggy Method]
@Override
public void setAsText(String text) throws IllegalArgumentException {
    String[] values = text.split(", ");
    Collection<Address> collection = new ArrayList<Address>();
    for (String value : values) {
        if (value.length() <= 1)
            continue;
        value.trim();
        String[] addressLine = value.split("--");
        Address address = new Address();
        address.setFirstLine(addressLine[0]);
        address.setSecondLine(addressLine[1]);
        address.setThirdLine(addressLine[2]);
        collection.add(address);
    }
    setValue(collection);
}

[Buggy Hunk]
Collection<Address> collection = new ArrayList<Address>();

[Patch]
AddressCollection collection = new AddressCollection();

[Demonstration 2]

[Buggy Method]
public void mostlyCycles(Method solverMainMethod, String[] args) {
    int filenameStartingIndex = Integer.parseInt(args[0]);
    // Iterate through the command line arguments
    int argPointer = 1;
    while (argPointer < args.length) {
        System.out.println("Processing problem size => " + args[argPointer]);
        int numVertices = Integer.parseInt(args[argPointer++]);
        // A set of solutions.
        // Used to ensure 4 unique test case files are generated.
        HashSet<String> solutions = new HashSet<String>();
        while (solutions.size() < 4) {
            // Initialize the list of file lines
            ArrayList<String> lines = new ArrayList<String>();
            // Create the filename for the test case.
            String inputFilename = "input_mostlyCycles";
            inputFilename += "_" + filenameStartingIndex;
            inputFilename += "_" + numVertices;
            inputFilename += ".txt";
            // Add the lines to the lines array.
            // Create an array of vertices
            ArrayList<Integer> availableVertices = new ArrayList<Integer>();
            for (int i = 1; i <= numVertices; i++) {
                availableVertices.add(i);
            }
            // Shuffle the array of vertices
            Collections.shuffle(availableVertices);
            while (!availableVertices.isEmpty()) {
                int maxComponentSize = availableVertices.size();
                int numVerticesInThisComponent;
                // Take out a portion of the available vertices to put in a strongly connected component.
                maxComponentSize = Math.max(1, maxComponentSize);
                numVerticesInThisComponent = ThreadLocalRandom.current().nextInt(maxComponentSize) + 1;
                // Put the next available vertices into a new array.
                ArrayList<Integer> thisComponentVertices = new ArrayList<Integer>();
                for (int i = 0; i < numVerticesInThisComponent && !availableVertices.isEmpty(); i++) {
                    thisComponentVertices.add(availableVertices.remove(0));
                }
                // Create a cycle among the vertices in this component.
                // Occasionally, add another connection within this component.
                if (thisComponentVertices.size() > 1) {
                    int startingVertex = thisComponentVertices.remove(0);
                    int prevVertex = startingVertex;
                    while (!thisComponentVertices.isEmpty()) {
                        int vertex = thisComponentVertices.remove(0);
                        // Potentially add some other internal connections.
                        if (!thisComponentVertices.isEmpty() && (ThreadLocalRandom.current().nextInt(101) < 3)) {
                            int numInternalConnections = ThreadLocalRandom.current().nextInt(numVerticesInThisComponent);
                            for (int i = 0; i < numInternalConnections; i++) {
                                int internalVertexToConnect = ThreadLocalRandom.current().nextInt((int) Math.sqrt(thisComponentVertices.size()));
                                lines.add(vertex + " " + thisComponentVertices.get(internalVertexToConnect));
                            }
                        }
                        lines.add(prevVertex + " " + vertex);
                        prevVertex = vertex;
                    }
                    // Connect the end of the cycle to the beginning
                    lines.add(prevVertex + " " + startingVertex);
                }
            }
            // Sort the lines by tail vertex index
            lines.sort(new tailOrder());
            // Write the input file.
            Path file = Paths.get(inputFilename);
            try {
                Files.write(file, lines, Charset.forName("UTF-8"));
            } catch (IOException exception) {
                exception.printStackTrace();
            }
            String[] filenames = { inputFilename };
            String solution = ClassCaller.callMethod(solverMainMethod, filenames);
            // create an output file for this solution only if it is a unique solution.
            if (!solutions.contains(solution)) {
                // Add this solution to the set of solutions so far.
                solutions.add(solution);
                AbstractTestCaseGenerator.generateOutputFile(inputFilename, solution);
                System.out.println("\t" + solutions.size() + " unique file(s) generated.");
                filenameStartingIndex++;
            }
        }
    }
}

[Buggy Hunk]
lines.sort(new tailOrder());

[Patch]
lines.sort(new TailOrder());

[Demonstration 3]

[Buggy Method]
private Mono<HttpStatus> fetch(int value) {
    return this.client.perform(HttpRequestBuilders.get(url)).extract(WebResponseExtractors.response(String.class)).map(response -> response.getStatusCode());
}

[Buggy Hunk]
return this.client.perform(HttpRequestBuilders.get(url)).extract(WebResponseExtractors.response(String.class))

[Patch]
return this.client.perform(ClientWebRequestBuilders.get(url)).extract(ResponseExtractors.response(String.class))