@Test public void setsSniperValuesInColumns() { SniperSnapshot bidding = sniper.getSnapshot().bidding(555, 666); context.checking( new Expectations() { { allowing(listener).tableChanged(with(anyInsertionEvent())); one(listener).tableChanged(with(aChangeInRow(0))); } }); model.sniperAdded(sniper); model.sniperStateChanged(bidding); assertRowMatchesSnapshot(0, bidding); }
@Test public void updatesCorrectRowForSniper() { AuctionSniper sniper2 = new AuctionSniper(new Item("item 1", 345), null); context.checking( new Expectations() { { allowing(listener).tableChanged(with(anyInsertionEvent())); one(listener).tableChanged(with(aChangeInRow(1))); } }); model.sniperAdded(sniper); model.sniperAdded(sniper2); SniperSnapshot winning1 = sniper2.getSnapshot().winning(123); model.sniperStateChanged(winning1); assertRowMatchesSnapshot(1, winning1); }
@Test(expected = Defect.class) public void throwsDefectIfNoExistingSniperForAnUpdate() { model.sniperStateChanged(new SniperSnapshot("item 1", 123, 234, SniperState.WINNING)); }