<commit_before>package org.jmock.test.example.sniper;

import org.hamcrest.Matcher;
import org.hamcrest.core.IsAnything;
import org.jmock.InAnyOrder;
import org.jmock.integration.junit3.MockObjectTestCase;

public class AuctionSniperTests extends MockObjectTestCase {
    Bid increment = new Bid(2);
    Bid maximumBid = new Bid(20);
    Bid beatableBid = new Bid(10);
    Bid unbeatableBid = maximumBid.add(new Bid(1));

    Lot lot = mock(Lot.class);
    AuctionSniperListener listener = mock(AuctionSniperListener.class, "listener");

    AuctionSniper sniper = new AuctionSniper(lot, increment, maximumBid, listener);

    public void testTriesToBeatTheLatestHighestBid() throws Exception {
        final Bid expectedBid = beatableBid.add(increment);

        expects(new InAnyOrder() {{
            exactly(1).of (lot).bid(expectedBid);
        }});

        sniper.bidAccepted(lot, beatableBid);
    }

    public void testWillNotBidPriceGreaterThanMaximum() throws Exception {
        expects(new InAnyOrder() {{
            allow (listener);
            never (lot).bid(with(any(Bid.class)));
        }});
        sniper.bidAccepted(lot, unbeatableBid);
    }

    public void testWillLimitBidToMaximum() throws Throwable {
        expects(new InAnyOrder() {{
            exactly(1).of (lot).bid(maximumBid);
        }});

        sniper.bidAccepted(lot, maximumBid.subtract(new Bid(1)));
    }
<commit_msg>sf np changed allow to ignore<commit_after>package org.jmock.test.example.sniper;

import org.hamcrest.Matcher;
import org.hamcrest.core.IsAnything;
import org.jmock.InAnyOrder;
import org.jmock.integration.junit3.MockObjectTestCase;

public class AuctionSniperTests extends MockObjectTestCase {
    Bid increment = new Bid(2);
    Bid maximumBid = new Bid(20);
    Bid beatableBid = new Bid(10);
    Bid unbeatableBid = maximumBid.add(new Bid(1));

    Lot lot = mock(Lot.class);
    AuctionSniperListener listener = mock(AuctionSniperListener.class, "listener");

    AuctionSniper sniper = new AuctionSniper(lot, increment, maximumBid, listener);

    public void testTriesToBeatTheLatestHighestBid() throws Exception {
        final Bid expectedBid = beatableBid.add(increment);

        expects(new InAnyOrder() {{
            exactly(1).of (lot).bid(expectedBid);
        }});

        sniper.bidAccepted(lot, beatableBid);
    }

    public void testWillNotBidPriceGreaterThanMaximum() throws Exception {
        expects(new InAnyOrder() {{
            ignore (listener);
            never (lot).bid(with(any(Bid.class)));
        }});
        sniper.bidAccepted(lot, unbeatableBid);
    }

    public void testWillLimitBidToMaximum() throws Throwable {
        expects(new InAnyOrder() {{
            exactly(1).of (lot).bid(maximumBid);
        }});

        sniper.bidAccepted(lot, maximumBid.subtract(new Bid(1)));
    }

{'fraction_non_alphanumeric': 0.11169652265542676, 'fraction_numerical': 0.007024938531787847, 'mean_word_length': 3.341463414634146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6889039', 'n_tokens_mistral': 942, 'n_tokens_neox': 921, 'n_words': 175}