[Demonstration 1]

[Buggy Method]
public static void waitForUrlToChangeFrom(final String currentUrl, final WebDriver driver) {
    WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME_IN_SEC);
    wait.until(new Predicate<WebDriver>() {

        @Override
        public boolean apply(WebDriver webDriver) {
            return !driver.getCurrentUrl().equals(currentUrl);
        }
    });
}

[Buggy Hunk]
WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME_IN_SEC);

[Patch]
WebDriverWait wait = new WebDriverWait(driver, 10);

[Demonstration 2]

[Buggy Method]
private int getNumOfValidatedQuestions(final List<QuestionDto> questions) {
    int numberOfValidated = 0;
    for (QuestionDto question : questions) {
        //question.getCode() == null
        if (!CODE_TYPE.equals(question.getType()) || !WRITE_TYPE.equals(question.getType())) {
            numberOfValidated++;
        }
    }
    return numberOfValidated;
}

[Buggy Hunk]
if(!CODE_TYPE.equals(question.getType()) || !WRITE_TYPE.equals(question.getType())) {

[Patch]
if(CHECK_TYPE.equals(question.getType()) || RADIO_TYPE.equals(question.getType())) {

[Demonstration 3]

[Buggy Method]
@Override
protected boolean parseMsg(String body, Data data) {
    Matcher match = RUN_REPORT_PTN.matcher(body);
    if (match.matches()) {
        setFieldList("ID UNIT INFO");
        data.msgType = MsgType.RUN_REPORT;
        data.strCallId = match.group(1);
        data.strUnit = match.group(2);
        data.strSupp = body.substring(match.end(2)).trim();
        return true;
    }
    if (parseFieldOnly) {
        if (!parseFields(body.split(";"), data))
            return false;
    } else {
        // Message must always start with dispatcher ID, which we promptly discard
        if (leadDispatch || optDispatch) {
            match = LEAD_PTN.matcher(body);
            if (match.find()) {
                body = body.substring(match.end()).trim();
            } else if (!optDispatch)
                return false;
        }
        // See if this looks like one of the new comma delimited page formats
        // If it is, let FieldProgramParser handle it.
        match = NAKED_TIME_PTN.matcher(body);
        if (!match.find())
            return false;
        String delim = match.group(1);
        if (delim.charAt(0) != ' ') {
            body = body.replace(" OCA:", delim + "OCA:");
            if (!parseFields(body.split(delim), data))
                return false;
        } else // Blank delimited fields get complicated
        // We already found a time field.  Use that to split the message
        // into and address and extra versions
        {
            setFieldList(defaultFieldList);
            data.strTime = match.group(2);
            String sAddr = body.substring(0, match.start()).trim();
            String sExtra = body.substring(match.end()).trim();
            // See if there is an ID field immediate in front of the time field
            match = ID_PTN.matcher(sAddr);
            if (match.find()) {
                data.strCallId = match.group();
                sAddr = sAddr.substring(0, match.start()).trim();
            } else if (!idOptional)
                return false;
            // See if there is a labeled OCA field at the end of the extra block
            match = OCA_TRAIL_PTN.matcher(sExtra);
            if (match.find()) {
                data.strCallId = match.group(1).trim();
                sExtra = sExtra.substring(0, match.start()).trim();
            }
            if (sAddr.length() > 0) {
                parseMain(sAddr, data);
                parseExtra(sExtra, data);
            } else {
                parseExtra2(sExtra, data);
            }
        }
    }
    // set an call description if we do not have one
    if (data.strCall.length() == 0 && data.strSupp.length() == 0)
        data.strCall = "ALERT";
    // Remove any asterisks or verify markers from cross street info
    data.strCross = data.strCross.replace("*", "");
    data.strCross = VERIFY_X_PTN.matcher(data.strCross).replaceAll(" ").trim();
    // Apparently there is no way to not enter a street number, entering 0 or 1 is the accepted
    // workaround.
    if (data.strAddress.startsWith("1 ") || data.strAddress.startsWith("0 ")) {
        data.strAddress = data.strAddress.substring(2).trim();
        String cross = data.strCross.replace('/', '&').replace("&", " & ").replaceAll("  +", " ").trim();
        data.strAddress = append(data.strAddress, " & ", cross);
        data.strCross = "";
    }
    //  Occasional implied intersections end up in the apt field
    if (data.strApt.length() > 0 && isValidAddress(data.strApt)) {
        data.strAddress = append(data.strAddress, " & ", data.strApt);
        data.strApt = "";
    }
    return true;
}

[Buggy Hunk]
if (!parseFields(body.split(delim), data)) return false;

[Patch]
if (!parseFields(body.split(delim + '+'), data)) return false;