Changeset 25 for exampleparties/randomparty/src/test/java
- Timestamp:
- 10/08/20 10:17:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java
r24 r25 7 7 import static org.mockito.Matchers.eq; 8 8 import static org.mockito.Mockito.mock; 9 import static org.mockito.Mockito.times; 9 10 import static org.mockito.Mockito.verify; 10 11 import static org.mockito.Mockito.when; … … 42 43 import geniusweb.inform.Finished; 43 44 import geniusweb.inform.Inform; 45 import geniusweb.inform.OptIn; 44 46 import geniusweb.inform.Settings; 45 47 import geniusweb.inform.Voting; … … 68 70 private final TestConnection connection = new TestConnection(); 69 71 private final ProtocolRef protocol = new ProtocolRef(SAOP); 72 private final ProtocolRef mopacProtocol = new ProtocolRef("MOPAC"); 70 73 private final ProgressRounds progress = mock(ProgressRounds.class); 71 private Settings settings ;74 private Settings settings, mopacSettings; 72 75 private LinearAdditive profile; 73 76 private final Parameters parameters = new Parameters(); … … 80 83 new ProfileRef(new URI("file:" + PROFILE)), protocol, progress, 81 84 parameters); 85 mopacSettings = new Settings(PARTY1, 86 new ProfileRef(new URI("file:" + PROFILE)), mopacProtocol, 87 progress, parameters); 82 88 83 89 String serialized = new String(Files.readAllBytes(Paths.get(PROFILE)), … … 174 180 175 181 @Test 176 public void testAgentsUpdates Progress() {182 public void testAgentsUpdatesSAOPProgress() { 177 183 party.connect(connection); 178 184 party.notifyChange(settings); … … 180 186 party.notifyChange(new YourTurn()); 181 187 verify(progress).advance(); 188 } 189 190 @Test 191 public void testAgentsUpdatesMOPACProgress() { 192 party.connect(connection); 193 party.notifyChange(mopacSettings); 194 // in mopac, progress happens only after optin phase 195 party.notifyChange(new YourTurn()); 196 verify(progress, times(0)).advance(); 197 party.notifyChange( 198 new Voting(Collections.emptyList(), Collections.emptyMap())); 199 verify(progress, times(0)).advance(); 200 party.notifyChange(new OptIn(Collections.emptyList())); 201 verify(progress, times(1)).advance(); 182 202 } 183 203 … … 199 219 200 220 @Test 201 public void testVoting() {202 party.connect(connection); 203 party.notifyChange( settings);221 public void testVoting() throws URISyntaxException { 222 party.connect(connection); 223 party.notifyChange(mopacSettings); 204 224 205 225 Bid bid = findGoodBid();
Note:
See TracChangeset
for help on using the changeset viewer.