Ignore:
Timestamp:
06/11/20 16:34:40 (4 years ago)
Author:
bart
Message:

Update to version 1.41

File:
1 edited

Legend:

Unmodified
Added
Removed
  • opponentmodel/src/test/java/geniusweb/profile/opponentmodel/FrequencyOppModelTest.java

    r14 r18  
    33import static org.junit.Assert.assertEquals;
    44import static org.junit.Assert.assertTrue;
     5import static org.mockito.Mockito.mock;
    56
    67import java.math.BigDecimal;
     
    1415import org.junit.Test;
    1516
     17import geniusweb.actions.Offer;
     18import geniusweb.actions.PartyId;
    1619import geniusweb.issuevalue.Bid;
    1720import geniusweb.issuevalue.DiscreteValue;
     
    2326import geniusweb.issuevalue.ValueSet;
    2427import geniusweb.opponentmodel.FrequencyOpponentModel;
     28import geniusweb.progress.Progress;
    2529import tudelft.utilities.junit.GeneralTests;
    2630
     
    3236        private static final DiscreteValue I1V2 = new DiscreteValue("i1v2");
    3337        private static final DiscreteValue I1V2b = new DiscreteValue("i1v2b");
     38        private static final Progress progress = mock(Progress.class);
     39        private static final PartyId other = new PartyId("other");
    3440
    3541        private static Domain domain, domain2, domain3;
     
    8591                oppModel2 = new FrequencyOpponentModel(domain2);
    8692                oppModel3 = new FrequencyOpponentModel(domain3);
    87                 oppModel4 = (FrequencyOpponentModel) oppModel3.update(bid1);
     93                oppModel4 = oppModel3.with(new Offer(other, bid1), progress);
    8894
    8995        }
     
    106112
    107113        @Test(expected = NullPointerException.class)
    108         public void smokeNullTest() {
     114        public void smokeTestNull() {
    109115                new FrequencyOpponentModel(null);
    110116        }
     
    124130        @Test
    125131        public void testUpdate() {
    126                 FrequencyOpponentModel oppModel = oppModel1.update(bid1);
     132                FrequencyOpponentModel oppModel = oppModel1.with(new Offer(other, bid1),
     133                                progress);
    127134                assertTrue(BigDecimal.ONE.compareTo(oppModel.getUtility(bid1)) == 0);
    128135                assertTrue(BigDecimal.ZERO.compareTo(oppModel.getUtility(bid3)) == 0);
     
    135142                // bid1 and bid2 both want I1V1. They differ on the number value.
    136143                // bid3 wants I1V2 but does have the number value from bid2
    137                 FrequencyOpponentModel oppModel = oppModel1.update(bid1).update(bid2);
     144                FrequencyOpponentModel oppModel = oppModel1
     145                                .with(new Offer(other, bid1), progress)
     146                                .with(new Offer(other, bid2), progress);
    138147                assertTrue(new BigDecimal("0.75")
    139148                                .compareTo(oppModel.getUtility(bid1)) == 0);
Note: See TracChangeset for help on using the changeset viewer.