[Demonstration 1]

[Buggy Method]
public void removeDevice(UserDevice u) {
    Connection con = null;
    try {
        con = getConnection();
        PreparedStatement sqlStmt = con.prepareStatement(u.getRemoveStmt());
        con.setAutoCommit(false);
        u.fillAddStmt(sqlStmt);
        sqlStmt.execute();
        con.commit();
        c.getCertAdmin().revokeCertificate(u.id);
    } catch (SQLException e) {
        c.getLog().log(Level.SEVERE, "Error deleting devices: " + e.getMessage());
        if (con != null) {
            try {
                con.rollback();
            } catch (SQLException e1) {
                c.getLog().log(Level.SEVERE, "Error while rollback: " + e1.getMessage());
            }
        }
    }
}

[Buggy Hunk]
u.fillAddStmt(sqlStmt);

[Patch]
u.fillRemoveStmt(sqlStmt);

[Demonstration 2]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));

[Demonstration 3]

[Buggy Method]
@Test
public void testGetAccounts() throws SQLException {
    //Test Get Accounts
    //Create User
    String username = "TestGetAccount";
    String password = "Test1234";
    String cpr = "TestGA1234";
    String userName = "Test Testy Test";
    String institute = "Test That Institute";
    String consultant = "";
    //Create user
    assertTrue(DB.createUser(username, password, cpr, userName, institute, consultant));
    User user = DB.getUserByCpr(cpr);
    assertNotNull(user);
    //Create Account
    int userId = user.getId();
    String accountName = "TestGetAccount";
    String type = "TestTypeForTestAccount";
    String number = "TestGA123456789";
    String iban = "TestGA123456IBAN";
    String currency = "EUR";
    double interest = 0.05;
    double balance = 0;
    //Create Account
    assertTrue(DB.createAccount(userId, accountName, type, number, iban, currency, interest, balance));
    Account newAccount = DB.getAccountByNumber(number);
    assertNotNull(newAccount);
    //Get Accounts
    ArrayList<Account> accounts = DB.getAccounts(userId);
    assertNotNull(accounts);
    //Assertion
    for (Account account : accounts) {
        assertNotNull(account.getBalance());
        assertNotNull(account.getCurrency());
        assertNotNull(account.getIban());
        assertNotNull(account.getId());
        assertNotNull(account.getInterest());
        assertNotNull(account.getName());
        assertNotNull(account.getNumber());
        assertNotNull(account.getType());
        assertNotNull(account.getUserId());
        //Range assertion
        assertTrue(0 < account.getId());
        assertTrue(0 < account.getUserId());
        assertTrue(0.0 == Double.parseDouble(account.getBalance().replace(',', '.')));
    }
}

[Buggy Hunk]
public void testGetAccounts() throws SQLException{

[Patch]
public void testGetAccounts() throws DatabaseException{