[Demonstration 1]

[Buggy Method]
public Player playerInput(Player p) {
    Player player = p;
    int betAmount = 0;
    Turn turn = mainApp.getPlayerInput();
    mainApp.disablePlayerInput();
    player.stats.overallDecisions += 1;
    player.stats.shortTermDecisions[this.numHandsPlayed % 10] += 1;
    switch(turn.getAction()) {
        case BET:
            int prevTotalBet = p.getTotalBet();
            betAmount = turn.getBetAmount();
            int callAmount = this.getTotalBet() - p.getTotalBet();
            if (this.getBetPeriod().equals(BetPeriod.PREFLOP)) {
                if (player.isSmallBlind() && !player.isCalledSB()) {
                    this.setCurrentBet(betAmount - this.getSmallBlindAmount());
                    player.call(this.getBigBlindAmount() - this.getSmallBlindAmount());
                    player.setCalledSB(true);
                    this.setTotalBet(this.getTotalBet() + this.getCurrentBet());
                    player.stats.shortTermAggression[this.numHandsPlayed % 10] += betAmount / this.getBigBlindAmount();
                } else {
                    if (callAmount > 0) {
                        player.call(callAmount);
                        this.setPot(this.getPot() + callAmount);
                        player.stats.shortTermAggression[this.numHandsPlayed % 10] += betAmount / callAmount;
                    } else {
                        player.stats.shortTermAggression[this.numHandsPlayed % 10] += 1;
                    }
                    betAmount = betAmount - callAmount;
                    this.setCurrentBet(betAmount);
                    this.setTotalBet(this.getTotalBet() + betAmount);
                }
            } else {
                if (callAmount > 0) {
                    player.call(callAmount);
                    this.setPot(this.getPot() + callAmount);
                    player.stats.shortTermAggression[this.numHandsPlayed % 10] += betAmount / callAmount;
                } else {
                    player.stats.shortTermAggression[this.numHandsPlayed % 10] += 1;
                }
                betAmount = betAmount - callAmount;
                this.setCurrentBet(betAmount);
                this.setTotalBet(this.getTotalBet() + betAmount);
            }
            player.bet(this.getCurrentBet());
            this.setPot(this.getPot() + this.getTotalBet() - callAmount - prevTotalBet);
            mainApp.updateBetAmountZero(Integer.toString(player.getTotalBet()));
            break;
        case CHECKCALL:
            if (this.getBetPeriod().equals(BetPeriod.PREFLOP) && player.isSmallBlind() && !player.isCalledSB()) {
                player.setCalledSB(true);
            }
            player.stats.shortTermAggression[this.numHandsPlayed % 10] += 1;
            player.call(turn.getBetAmount());
            this.setPot(this.getPot() + turn.getBetAmount());
            mainApp.updateBetAmountZero(Integer.toString(player.getTotalBet()));
            break;
        case FOLD:
            player.setInHand(false);
            this.setPlayersInHand(this.getPlayersInHand() - 1);
            System.out.println("Player " + player.getId() + " folds");
            mainApp.updateConsole("Player " + player.getId() + " folds");
            player.stats.folds++;
            switch(this.betPeriod) {
                case PREFLOP:
                    player.stats.preFlopFolds++;
                    break;
                case FLOP:
                    player.stats.flopFolds++;
                    break;
                case TURN:
                    player.stats.turnFolds++;
                    break;
                case RIVER:
                    player.stats.riverFolds++;
                    break;
                case EVAL:
                    break;
                default:
                    break;
            }
            break;
        default:
            break;
    }
    return player;
}

[Buggy Hunk]
this.setPot(this.getPot() + this.getTotalBet() - callAmount - prevTotalBet);

[Patch]
this.setPot(this.getPot() + betAmount);

[Demonstration 2]

[Buggy Method]
@Override
public void valida(Funcionario funcionario, Reajuste reajuste) throws ValidacaoException {
    Period periodoNaEmpresa = funcionario.getDataAdmissao().until(LocalDate.now());
    if (periodoNaEmpresa.getMonths() < 3) {
        throw new ValidacaoException("Funcionário não pode receber reajuste pois ainda está em período de experiência!");
    }
}

[Buggy Hunk]
if (periodoNaEmpresa.getMonths() < 3) {

[Patch]
if (periodoNaEmpresa.toTotalMonths() < 3) {

[Demonstration 3]

[Buggy Method]
private static void printAuszuege(Collection<Kontoauszug> auszuege) {
    Collection<PrintableColumn<Posten>> columns = Arrays.asList(//
    right("Betrag", e -> e.gutschrift() ? "+" : "-" + e.betrag() + " CHF"), //
    left("Kategorie", e -> e.kategorie().name()), left("Beschreibung", e -> e.kategorie().equals(Lastschrift.SONSTIGES) ? e.verwendung() : ""));
    ConsolePrinter<Posten> printer = new ConsolePrinter<>(columns);
    //
    auszuege.stream().//
    sorted().forEach(auszug -> {
        System.out.println(String.format("%s Posten für '%s':", auszug.posten().size(), auszug.monat()));
        Collection<Posten> posten = //
        auszug.posten().stream().sorted(//
        (a, b) -> a.kategorie().name().compareTo(b.kategorie().name())).collect(toList());
        printer.print(posten);
    });
}

[Buggy Hunk]
right("Betrag", e -> e.gutschrift() ? "+" : "-" + e.betrag() + " CHF"), //

[Patch]
right("Betrag", e -> (e.gutschrift() ? "+" : "-") + e.betrag() + " CHF"), //