[Demonstration 1]

[Buggy Method]
public static void outputText(String s) {
    String timeStamp = createTimeStamp();
    outputWindow.appendText(timeStamp + s + "\n");
}

[Buggy Hunk]
public static void outputText(String s) {

[Patch]
public void outputText(String s) {

[Demonstration 2]

[Buggy Method]
@Test
public void testReplacePlayersTilesDoesntReplaceWrongTiles() {
    String board = "11111;0000010002000;12345";
    String tiles = SaveTheIslandGame.Board.replacePlayersTiles(board, 1, 6, 2);
    int count = 0;
    System.out.println(tiles);
    for (int i = 0; i < tiles.length(); i++) {
        if (tiles.substring(i, i + 1).equals("1")) {
            count++;
        }
    }
    assertEquals(5, count);
}

[Buggy Hunk]
String tiles = SaveTheIslandGame.Board.replacePlayersTiles(board, 1, 6, 2);

[Patch]
String tiles = SaveTheIslandGame.Board.getNewTiles(board, 1, 6, 2);

[Demonstration 3]

[Buggy Method]
public static BagMongo connect(MongoClientURI clientUri, String collectionName) {
    // try to get the client
    MongoClient mongoClient = MONGO_CLIENTS.get(clientUri);
    if (mongoClient == null) {
        mongoClient = new MongoClient(clientUri);
        try {
            mongoClient.getAddress();
        } catch (Exception exception) {
            log.error("Failed to connect to (" + clientUri + ")", exception);
            return null;
        }
        MONGO_CLIENTS.put(clientUri, mongoClient);
    }
    // try to get the collection
    MongoDatabase database = mongoClient.getDatabase("BagMongo");
    MongoCollection<Document> collection = database.getCollection("test");
    if (collection != null) {
        log.info("Connected to \"" + collectionName + "\"");
        return new BagMongo(collectionName, collection);
    } else {
        log.error("Failed to connect to \"" + collectionName + "\", (UNKNOWN ERROR)");
        return null;
    }
}

[Buggy Hunk]
MongoCollection<Document> collection = database.getCollection ("test" );

[Patch]
MongoCollection<Document> collection = database.getCollection (collectionName );