Changeset 18 for opponentmodel/src/test/java
- Timestamp:
- 06/11/20 16:34:40 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
opponentmodel/src/test/java/geniusweb/profile/opponentmodel/FrequencyOppModelTest.java
r14 r18 3 3 import static org.junit.Assert.assertEquals; 4 4 import static org.junit.Assert.assertTrue; 5 import static org.mockito.Mockito.mock; 5 6 6 7 import java.math.BigDecimal; … … 14 15 import org.junit.Test; 15 16 17 import geniusweb.actions.Offer; 18 import geniusweb.actions.PartyId; 16 19 import geniusweb.issuevalue.Bid; 17 20 import geniusweb.issuevalue.DiscreteValue; … … 23 26 import geniusweb.issuevalue.ValueSet; 24 27 import geniusweb.opponentmodel.FrequencyOpponentModel; 28 import geniusweb.progress.Progress; 25 29 import tudelft.utilities.junit.GeneralTests; 26 30 … … 32 36 private static final DiscreteValue I1V2 = new DiscreteValue("i1v2"); 33 37 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"); 34 40 35 41 private static Domain domain, domain2, domain3; … … 85 91 oppModel2 = new FrequencyOpponentModel(domain2); 86 92 oppModel3 = new FrequencyOpponentModel(domain3); 87 oppModel4 = (FrequencyOpponentModel) oppModel3.update(bid1);93 oppModel4 = oppModel3.with(new Offer(other, bid1), progress); 88 94 89 95 } … … 106 112 107 113 @Test(expected = NullPointerException.class) 108 public void smoke NullTest() {114 public void smokeTestNull() { 109 115 new FrequencyOpponentModel(null); 110 116 } … … 124 130 @Test 125 131 public void testUpdate() { 126 FrequencyOpponentModel oppModel = oppModel1.update(bid1); 132 FrequencyOpponentModel oppModel = oppModel1.with(new Offer(other, bid1), 133 progress); 127 134 assertTrue(BigDecimal.ONE.compareTo(oppModel.getUtility(bid1)) == 0); 128 135 assertTrue(BigDecimal.ZERO.compareTo(oppModel.getUtility(bid3)) == 0); … … 135 142 // bid1 and bid2 both want I1V1. They differ on the number value. 136 143 // 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); 138 147 assertTrue(new BigDecimal("0.75") 139 148 .compareTo(oppModel.getUtility(bid1)) == 0);
Note:
See TracChangeset
for help on using the changeset viewer.